From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Don Koch <dkoch@verizon.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>,
Xen Coverity Team <coverity@xen.org>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tools/Coverity: Audit of MISSING_BREAK defects
Date: Fri, 13 Feb 2015 10:51:29 +0000 [thread overview]
Message-ID: <54DDD731.2020608@citrix.com> (raw)
In-Reply-To: <20150212154939.cdf3ab086e26f5dab06b1026@verizon.com>
On 12/02/15 20:49, Don Koch wrote:
> On Thu, 12 Feb 2015 20:08:33 +0000
> Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>
>> 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
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> Coverity-IDs: 1055464, 1055465, 1055467, 1055468, 1055481, 1055482
>> CC: Ian Campbell <Ian.Campbell@citrix.com>
>> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
>> CC: Wei Liu <wei.liu2@citrix.com>
>> CC: Xen Coverity Team <coverity@xen.org>
>> ---
>> 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(+)
>>
>> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
>> index 440db78..53c16eb 100644
>> --- a/tools/libxl/xl_cmdimpl.c
>> +++ b/tools/libxl/xl_cmdimpl.c
>> @@ -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':
>> diff --git a/tools/misc/gtracestat.c b/tools/misc/gtracestat.c
>> index 874a043..a59e536 100644
>> --- a/tools/misc/gtracestat.c
>> +++ b/tools/misc/gtracestat.c
>> @@ -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;
>> diff --git a/tools/misc/gtraceview.c b/tools/misc/gtraceview.c
>> index cf9287c..501f86a 100644
>> --- a/tools/misc/gtraceview.c
>> +++ b/tools/misc/gtraceview.c
>> @@ -1097,6 +1097,7 @@ void choose_cpus(void)
>> this->init();
>> return;
>> }
>> + /* fallthrough */
>> case KEY_F(4):
>> exit(EXIT_SUCCESS);
>> }
>> diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
>> index 3062cb5..23b57f1 100644
>> --- a/tools/xenstat/xentop/xentop.c
>> +++ b/tools/xenstat/xentop/xentop.c
>> @@ -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...
> Reviewed-by: Don Koch <dkoch@verizon.com>
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
>
>> default:
>> if((prompt_val_len+1) < PROMPT_VAL_LEN
>> && isprint(ch)) {
>> diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
>> index 1054f18..3d14d37 100644
>> --- a/tools/xenstore/xenstore_client.c
>> +++ b/tools/xenstore/xenstore_client.c
>> @@ -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);
>> --
>> 1.7.10.4
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
>>
next prev parent reply other threads:[~2015-02-13 10:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 20:08 [PATCH] tools/Coverity: Audit of MISSING_BREAK defects Andrew Cooper
2015-02-12 20:49 ` Don Koch
2015-02-13 10:51 ` Andrew Cooper [this message]
2015-02-13 10:38 ` Wei Liu
2015-02-23 10:08 ` Andrew Cooper
2015-02-24 16:45 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DDD731.2020608@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=coverity@xen.org \
--cc=dkoch@verizon.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.