Skip to contentSkip to conversation

domain: try to address Coverity pointing out a missing "break" in domain_teardown()

PATCH In review Jan Beulich 3 participants 6 messages Sep 1, 2021 – Sep 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 domain: try to address Coverity pointing out a missing "break" in domain_teardown()

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Coverity-ID: 1490865

---
If this doesn't help, I'm afraid I'm lost as to what Coverity means us to do to silence the reporting.

xen/common/domain.c +2 -2
@@ -401,13 +401,13 @@ static int domain_teardown(struct domain
          */
 #define PROGRESS(x)                             \
         d->teardown.val = PROG_ ## x;           \
-        /* Fallthrough */                       \
+        fallthrough;                            \
     case PROG_ ## x
 
 #define PROGRESS_VCPU(x)                        \
         d->teardown.val = PROG_vcpu_ ## x;      \
         d->teardown.vcpu = v;                   \
-        /* Fallthrough */                       \
+        fallthrough;                            \
     case PROG_vcpu_ ## x:                       \
         v = d->teardown.vcpu
 
Reviewed-by on v1 1/1
#1 lore raw

Hi Jan,

Quoted 12 lines · Jan Beulich

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Quoted 7 lines

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Coverity-ID: 1490865

A grep inside Xen code show that we have occurence of:
/* fallthrough */
/* Fallthrough */
falltrough

Should we actually fix all of them ?

Anyway this can be in an other patch.

Cheers
Bertrand

Quoted 24 lines

---
If this doesn't help, I'm afraid I'm lost as to what Coverity means us to do to silence the reporting.

xen/common/domain.c +2 -2
@@ -401,13 +401,13 @@ static int domain_teardown(struct domain
         */
 #define PROGRESS(x)                             \
        d->teardown.val = PROG_ ## x;           \
-        /* Fallthrough */                       \
+        fallthrough;                            \
    case PROG_ ## x
 
 #define PROGRESS_VCPU(x)                        \
        d->teardown.val = PROG_vcpu_ ## x;      \
        d->teardown.vcpu = v;                   \
-        /* Fallthrough */                       \
+        fallthrough;                            \
    case PROG_vcpu_ ## x:                       \
        v = d->teardown.vcpu
 
#2 lore raw
Quoted 19 lines · Bertrand Marquis
Quoted 11 lines · Jan Beulich

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Quoted 7 lines

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Coverity-ID: 1490865

Quoted 6 lines

A grep inside Xen code show that we have occurence of:
/* fallthrough */
/* Fallthrough */
falltrough

Should we actually fix all of them ?

I don't think so, or at least don't view this as urgent. As described what I'm suspecting here is an issue with such comments living inside macros. I don't think we have too many instances of such. In case my guess is right (and hence in case the patch actually helps), we may want to change all in this much smaller set, but as you say ...

Quoted 1 line

Anyway this can be in an other patch.

... in a separate patch (not the least because we still need to see whether the change helps in the first place).

Quoted 1 line

Thanks.

Jan

Acked-by on v1 1/1
#3 lore raw
In reply to Jan Beulich

Hi Jan,

Quoted 10 lines · Jan Beulich

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Quoted 7 lines

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Coverity-ID: 1490865

Quoted 13 lines

---
If this doesn't help, I'm afraid I'm lost as to what Coverity means us to do to silence the reporting.

xen/common/domain.c +1 -1
@@ -401,13 +401,13 @@ static int domain_teardown(struct domain
           */
  #define PROGRESS(x)                             \
          d->teardown.val = PROG_ ## x;           \
-        /* Fallthrough */                       \
+        fallthrough;                            \

xen/common/domain.c static int domain_teardown(struct domain · line 413

Quoted 10 lines
xen/common/domain.c +1 -1
      case PROG_ ## x
 
  #define PROGRESS_VCPU(x)                        \
          d->teardown.val = PROG_vcpu_ ## x;      \
          d->teardown.vcpu = v;                   \
-        /* Fallthrough */                       \
+        fallthrough;                            \
      case PROG_vcpu_ ## x:                       \
          v = d->teardown.vcpu
 

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
In reply to Jan Beulich
Quoted 15 lines · Jan Beulich

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Quoted 5 lines

Coverity-ID: 1490865

---
If this doesn't help, I'm afraid I'm lost as to what Coverity means us to do to silence the reporting.

According to the most recent report this did not help. Shall I revert the change? Or do we consider it a step towards using the pseudo keyword more uniformly?

Jan

Quoted 20 lines
xen/common/domain.c +2 -2
@@ -401,13 +401,13 @@ static int domain_teardown(struct domain
          */
 #define PROGRESS(x)                             \
         d->teardown.val = PROG_ ## x;           \
-        /* Fallthrough */                       \
+        fallthrough;                            \
     case PROG_ ## x
 
 #define PROGRESS_VCPU(x)                        \
         d->teardown.val = PROG_vcpu_ ## x;      \
         d->teardown.vcpu = v;                   \
-        /* Fallthrough */                       \
+        fallthrough;                            \
     case PROG_vcpu_ ## x:                       \
         v = d->teardown.vcpu
 
#5 lore raw
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Jan Beulich

Commit 806448806264 ("xen/domain: Fix label position in domain_teardown()" has caused Coverity to report a _new_ supposedly un-annotated fall-through in a switch(). I find this (once again) puzzling; I'm having an increasingly hard time figuring what patterns the tool is actually after. I would have expected that the tool would either have spotted an issue also before this change, or not at all. Yet if it had spotted one before, the statistics report should have included an eliminated instance alongside the new one (because then the issue would simply have moved by a few lines).

Hence the only thing I could guess is that the treatment of comments in macro expansions might be subtly different. Therefore try whether switching the comments to the still relatively new "fallthrough" pseudo keyword actually helps.

Quoted 7 lines
Quoted 5 lines

Coverity-ID: 1490865

---
If this doesn't help, I'm afraid I'm lost as to what Coverity means us to do to silence the reporting.

According to the most recent report this did not help.

Just noticed that this was rubbish: I thought I had committed the change, but I actually didn't. Now I'm about to - let's see what happens.

Jan