Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2016 09:42:30 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        brde@optusnet.com.au
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r299588 - head/usr.sbin/binmiscctl
Message-ID:  <201605131642.u4DGgUt5060836@gw.catspoiler.org>
In-Reply-To: <20160514013315.K1048@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 14 May, Bruce Evans wrote:
> On Fri, 13 May 2016, Don Lewis wrote:
> 
>> Log:
>>  Revert r299584:
>>    Mark usage() as __dead2 so that Coverity doesn't think that execution
>>    continues after the call and uses a negative array subscript.
>>
>>  Requested by:	bde
> 
> Thanks.
> 
> What was the problem that confused Coverity?

It sees that demux_cmd() can return -1.  It takes the true branch
of "if (cmd == -1)" and calls usage.  It then falls through and thinks
that cmds[] is getting indexed with a negative value on line 423.

Taking a closer look at the comments that Coverity added makes me wonder
if changing the test to "if (cmd < 0)" might unconfuse it.

> This reminds me that even compilers can see that usage() doesn't return,
> by looking ahead and even inlining usage().  This breaks debugging and
> profiling.  clang doesn't support the -funit-at-a-time and
> -fno-inline-functions-called-once needed to reduce its excessive inlining.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605131642.u4DGgUt5060836>