[libvirt] [PATCH 10/12] build: silence coverity false positives

Eric Blake eblake at redhat.com
Mon Jun 6 19:43:02 UTC 2011


Coverity complained about these intentional fallthrough cases, but
not about other cases that were explicitly marked with nice comments.

For some reason, Coverity doesn't seem smart enough to parse the
up-front English comment in virsh about intentional fallthrough :)

* tools/virsh.c (cmdVolSize): Mark fallthrough in a more typical
fashion.
* src/conf/nwfilter_conf.c (virNWFilterRuleDefDetailsFormat)
(virNWFilterRuleDetailsParse): Mark explicit fallthrough.
---
 src/conf/nwfilter_conf.c |    4 ++++
 tools/virsh.c            |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 40516c7..127d4be 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -1490,6 +1490,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
                     switch (datatype) {
                         case DATATYPE_UINT8_HEX:
                             base = 16;
+                            /* fallthrough */
                         case DATATYPE_UINT8:
                             if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
                                 if (uint_val <= 0xff) {
@@ -1504,6 +1505,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,

                         case DATATYPE_UINT16_HEX:
                             base = 16;
+                            /* fallthrough */
                         case DATATYPE_UINT16:
                             if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
                                 if (uint_val <= 0xffff) {
@@ -2728,6 +2730,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,

                case DATATYPE_UINT8_HEX:
                    asHex = true;
+                   /* fallthrough */
                case DATATYPE_IPMASK:
                case DATATYPE_IPV6MASK:
                    /* display all masks in CIDR format */
@@ -2738,6 +2741,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,

                case DATATYPE_UINT16_HEX:
                    asHex = true;
+                   /* fallthrough */
                case DATATYPE_UINT16:
                    virBufferAsprintf(buf, asHex ? "0x%x" : "%d",
                                      item->u.u16);
diff --git a/tools/virsh.c b/tools/virsh.c
index d98be1c..a720185 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -7027,10 +7027,13 @@ static int cmdVolSize(const char *data, unsigned long long *val)
         switch (*end) {
         case 'T':
             *val *= 1024;
+            /* fallthrough */
         case 'G':
             *val *= 1024;
+            /* fallthrough */
         case 'M':
             *val *= 1024;
+            /* fallthrough */
         case 'k':
             *val *= 1024;
             break;
-- 
1.7.4.4




More information about the libvir-list mailing list