tools/Coverity: Audit of MISSING_BREAK defects
PATCH 1/1 tools/Coverity: Audit of MISSING_BREAK defects
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentop
All other identified defaults are legitimate fallthoughs
Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>
--- tools/libxl/xl_cmdimpl.c | 3 +++ tools/misc/gtracestat.c | 1 + tools/misc/gtraceview.c | 1 + tools/xenstat/xentop/xentop.c | 1 + tools/xenstore/xenstore_client.c | 1 + 5 files changed, 7 insertions(+)
tools/libxl/xl_cmdimpl.c +3 -0
@@ -2752,11 +2752,14 @@ static int64_t parse_mem_size_kb(const char *mem)switch (tolower ((uint8_t )*endptr)) {case 't' : kbytes <<=10 ; +/* fallthrough */ case 'g' : kbytes <<=10 ; +/* fallthrough */ case '\0' :case 'm' : kbytes <<=10 ; +/* fallthrough */ case 'k' :break ;case 'b' :
tools/misc/gtracestat.c +1 -0
@@ -167,6 +167,7 @@ int main(int argc, char *argv[]) tsc2phase =atoll (optarg);if (tsc2phase <=0 ) tsc2phase =55800000UL ; +break ;case 'd' : is_digest =1 ;break ;
tools/misc/gtraceview.c +1 -0
@@ -1097,6 +1097,7 @@ void choose_cpus(void) this->init ();return ; } +/* fallthrough */ case KEY_F (4 ):exit (EXIT_SUCCESS ); }
tools/xenstat/xentop/xentop.c +1 -0
@@ -407,6 +407,7 @@ static int handle_key(int ch)case KEY_BACKSPACE :if (prompt_val_len >0 ) prompt_val[--prompt_val_len] ='\0' ; +break ;default :if ((prompt_val_len+1 ) <PROMPT_VAL_LEN &&isprint (ch)) {
tools/xenstore/xenstore_client.c +1 -0
@@ -87,6 +87,7 @@ usage(enum mode mode, int incl_mode, const char *progname)errx (1 ,"Usage: %s %s[-h] [-s] [-t] key [...]" , progname, mstr);case MODE_exists: mstr = incl_mode ?"exists " :"" ; +/* fallthrough */ case MODE_list: mstr = mstr ? : incl_mode ?"list " :"" ;errx (1 ,"Usage: %s %s[-h] [-p] [-s] key [...]" , progname, mstr);
Signature · 1 line
1.7.10.4
Quoted 75 lines · On Thu, 12 Feb 2015 20:08:33 +0000 Andrew Cooper <[email protected]>…
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentopAll other identified defaults are legitimate fallthoughs
Signed-off-by Andrew Cooper <[email protected]>Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>--- tools/libxl/xl_cmdimpl.c | 3 +++ tools/misc/gtracestat.c | 1 + tools/misc/gtraceview.c | 1 + tools/xenstat/xentop/xentop.c | 1 + tools/xenstore/xenstore_client.c | 1 + 5 files changed, 7 insertions(+)tools/libxl/xl_cmdimpl.c +3
-0@@ -2752,11 +2752,14 @@ static int64_t parse_mem_size_kb(const char *mem)switch (tolower ((uint8_t )*endptr)) {case 't' : kbytes <<=10 ; +/* fallthrough */ case 'g' : kbytes <<=10 ; +/* fallthrough */ case '\0' :case 'm' : kbytes <<=10 ; +/* fallthrough */ case 'k' :break ;case 'b' :tools/misc/gtracestat.c +1
-0@@ -167,6 +167,7 @@ int main(int argc, char *argv[]) tsc2phase =atoll (optarg);if (tsc2phase <=0 ) tsc2phase =55800000UL ; +break ;case 'd' : is_digest =1 ;break ;tools/misc/gtraceview.c +1
-0@@ -1097,6 +1097,7 @@ void choose_cpus(void) this->init ();return ; } +/* fallthrough */ case KEY_F (4 ):exit (EXIT_SUCCESS ); }tools/xenstat/xentop/xentop.c +0
-0
tools/xenstat/xentop/xentop.c static int handle_key(int ch) · line 410
Quoted 4 lines
tools/xenstat/xentop/xentop.c +1
-0@@ -407,6 +407,7 @@ static int handle_key(int ch)case KEY_BACKSPACE :if (prompt_val_len >0 ) prompt_val[--prompt_val_len] ='\0' ; +break ;
Whitespace? (Yeah, inconsistent tools dir coding style. :-P )
Otherwise...
Quoted 24 lines
tools/xenstat/xentop/xentop.c +0
-0default :if ((prompt_val_len+1 ) <PROMPT_VAL_LEN &&isprint (ch)) {tools/xenstore/xenstore_client.c +1
-0@@ -87,6 +87,7 @@ usage(enum mode mode, int incl_mode, const char *progname)errx (1 ,"Usage: %s %s[-h] [-s] [-t] key [...]" , progname, mstr);case MODE_exists: mstr = incl_mode ?"exists " :"" ; +/* fallthrough */ case MODE_list: mstr = mstr ? : incl_mode ?"list " :"" ;errx (1 ,"Usage: %s %s[-h] [-p] [-s] key [...]" , progname, mstr);Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 84 lines · Don Koch
Quoted 75 lines · On Thu, 12 Feb 2015 20:08:33 +0000 Andrew Cooper <[email protected]>…
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentopAll other identified defaults are legitimate fallthoughs
Signed-off-by Andrew Cooper <[email protected]>Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>--- tools/libxl/xl_cmdimpl.c | 3 +++ tools/misc/gtracestat.c | 1 + tools/misc/gtraceview.c | 1 + tools/xenstat/xentop/xentop.c | 1 + tools/xenstore/xenstore_client.c | 1 + 5 files changed, 7 insertions(+)tools/libxl/xl_cmdimpl.c +3
-0@@ -2752,11 +2752,14 @@ static int64_t parse_mem_size_kb(const char *mem)switch (tolower ((uint8_t )*endptr)) {case 't' : kbytes <<=10 ; +/* fallthrough */ case 'g' : kbytes <<=10 ; +/* fallthrough */ case '\0' :case 'm' : kbytes <<=10 ; +/* fallthrough */ case 'k' :break ;case 'b' :tools/misc/gtracestat.c +1
-0@@ -167,6 +167,7 @@ int main(int argc, char *argv[]) tsc2phase =atoll (optarg);if (tsc2phase <=0 ) tsc2phase =55800000UL ; +break ;case 'd' : is_digest =1 ;break ;tools/misc/gtraceview.c +1
-0@@ -1097,6 +1097,7 @@ void choose_cpus(void) this->init ();return ; } +/* fallthrough */ case KEY_F (4 ):exit (EXIT_SUCCESS ); }tools/xenstat/xentop/xentop.c +0
-0tools/xenstat/xentop/xentop.c static int handle_key(int ch) · line 410
Quoted 4 lines
tools/xenstat/xentop/xentop.c +1
-0@@ -407,6 +407,7 @@ static int handle_key(int ch)case KEY_BACKSPACE :if (prompt_val_len >0 ) prompt_val[--prompt_val_len] ='\0' ; +break ;Whitespace? (Yeah, inconsistent tools dir coding style. :-P )
Quoted 2 lines
Otherwise...
Reviewed-by Don Koch <[email protected]>
Urgh - I thought I had fixed all of that. (I did specifically try)
I can resubmit, or it could be fixed on commit, at the preference of the committer.
~Andrew
Quoted 25 lines
Quoted 25 lines
tools/xenstat/xentop/xentop.c +0
-0default :if ((prompt_val_len+1 ) <PROMPT_VAL_LEN &&isprint (ch)) {tools/xenstore/xenstore_client.c +1
-0@@ -87,6 +87,7 @@ usage(enum mode mode, int incl_mode, const char *progname)errx (1 ,"Usage: %s %s[-h] [-s] [-t] key [...]" , progname, mstr);case MODE_exists: mstr = incl_mode ?"exists " :"" ; +/* fallthrough */ case MODE_list: mstr = mstr ? : incl_mode ?"list " :"" ;errx (1 ,"Usage: %s %s[-h] [-p] [-s] key [...]" , progname, mstr);Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 11 lines · Andrew Cooper
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentop
Quoted 8 lines
All other identified defaults are legitimate fallthoughs
Signed-off-by Andrew Cooper <[email protected]>Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>
Ping? Do I need any more acks/reviews for this patch?
~Andrew
Quoted 94 lines · Andrew Cooper
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentopAll other identified defaults are legitimate fallthoughs
Signed-off-by Andrew Cooper <[email protected]>Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>--- tools/libxl/xl_cmdimpl.c | 3 +++ tools/misc/gtracestat.c | 1 + tools/misc/gtraceview.c | 1 + tools/xenstat/xentop/xentop.c | 1 + tools/xenstore/xenstore_client.c | 1 + 5 files changed, 7 insertions(+)tools/libxl/xl_cmdimpl.c +3
-0@@ -2752,11 +2752,14 @@ static int64_t parse_mem_size_kb(const char *mem)switch (tolower ((uint8_t )*endptr)) {case 't' : kbytes <<=10 ; +/* fallthrough */ case 'g' : kbytes <<=10 ; +/* fallthrough */ case '\0' :case 'm' : kbytes <<=10 ; +/* fallthrough */ case 'k' :break ;case 'b' :tools/misc/gtracestat.c +1
-0@@ -167,6 +167,7 @@ int main(int argc, char *argv[]) tsc2phase =atoll (optarg);if (tsc2phase <=0 ) tsc2phase =55800000UL ; +break ;case 'd' : is_digest =1 ;break ;tools/misc/gtraceview.c +1
-0@@ -1097,6 +1097,7 @@ void choose_cpus(void) this->init ();return ; } +/* fallthrough */ case KEY_F (4 ):exit (EXIT_SUCCESS ); }tools/xenstat/xentop/xentop.c +1
-0@@ -407,6 +407,7 @@ static int handle_key(int ch)case KEY_BACKSPACE :if (prompt_val_len >0 ) prompt_val[--prompt_val_len] ='\0' ; +break ;default :if ((prompt_val_len+1 ) <PROMPT_VAL_LEN &&isprint (ch)) {tools/xenstore/xenstore_client.c +1
-0@@ -87,6 +87,7 @@ usage(enum mode mode, int incl_mode, const char *progname)errx (1 ,"Usage: %s %s[-h] [-s] [-t] key [...]" , progname, mstr);case MODE_exists: mstr = incl_mode ?"exists " :"" ; +/* fallthrough */ case MODE_list: mstr = mstr ? : incl_mode ?"list " :"" ;errx (1 ,"Usage: %s %s[-h] [-p] [-s] key [...]" , progname, mstr);
Sorry, I failed to spot the subtle s/Xen/tools/ compared with the other one. Applied.
Quoted 100 lines · Andrew Cooper
Ping? Do I need any more acks/reviews for this patch?
~Andrew
Quoted 94 lines · Andrew Cooper
Coverity uses several heuristics to identify when one case statement legitimately falls through into the next, and a comment as the final item in a case statement is one heuristic (the assumption being that it is a justification for the fallthrough).
Use this to perform an audit of defects and hide the legitimate fallthroughs.
There are two bugfixes identified in the audit, both minor:
* 'n' command line handling for gtracestat
* BKSPC handling in xentopAll other identified defaults are legitimate fallthoughs
Signed-off-by Andrew Cooper <[email protected]>Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xen Coverity Team <[email protected]>--- tools/libxl/xl_cmdimpl.c | 3 +++ tools/misc/gtracestat.c | 1 + tools/misc/gtraceview.c | 1 + tools/xenstat/xentop/xentop.c | 1 + tools/xenstore/xenstore_client.c | 1 + 5 files changed, 7 insertions(+)tools/libxl/xl_cmdimpl.c +3
-0@@ -2752,11 +2752,14 @@ static int64_t parse_mem_size_kb(const char *mem)switch (tolower ((uint8_t )*endptr)) {case 't' : kbytes <<=10 ; +/* fallthrough */ case 'g' : kbytes <<=10 ; +/* fallthrough */ case '\0' :case 'm' : kbytes <<=10 ; +/* fallthrough */ case 'k' :break ;case 'b' :tools/misc/gtracestat.c +1
-0@@ -167,6 +167,7 @@ int main(int argc, char *argv[]) tsc2phase =atoll (optarg);if (tsc2phase <=0 ) tsc2phase =55800000UL ; +break ;case 'd' : is_digest =1 ;break ;tools/misc/gtraceview.c +1
-0@@ -1097,6 +1097,7 @@ void choose_cpus(void) this->init ();return ; } +/* fallthrough */ case KEY_F (4 ):exit (EXIT_SUCCESS ); }tools/xenstat/xentop/xentop.c +1
-0@@ -407,6 +407,7 @@ static int handle_key(int ch)case KEY_BACKSPACE :if (prompt_val_len >0 ) prompt_val[--prompt_val_len] ='\0' ; +break ;default :if ((prompt_val_len+1 ) <PROMPT_VAL_LEN &&isprint (ch)) {tools/xenstore/xenstore_client.c +1
-0@@ -87,6 +87,7 @@ usage(enum mode mode, int incl_mode, const char *progname)errx (1 ,"Usage: %s %s[-h] [-s] [-t] key [...]" , progname, mstr);case MODE_exists: mstr = incl_mode ?"exists " :"" ; +/* fallthrough */ case MODE_list: mstr = mstr ? : incl_mode ?"list " :"" ;errx (1 ,"Usage: %s %s[-h] [-p] [-s] key [...]" , progname, mstr);