[lvm-devel] [PATCH 29/29] Check for NULL pointer

Zdenek Kabelac zkabelac at redhat.com
Tue Nov 30 12:33:55 UTC 2010


Dne 29.11.2010 23:47, Alasdair G Kergon napsal(a):
> On Fri, Nov 26, 2010 at 12:02:33AM +0100, Zdenek Kabelac wrote:
>> +	default:
>> +		log_error(INTERNAL_ERROR "Unknown report type.");
>> +		return ECMD_FAILED;
> 
> It's an enum where we cover every value.  An assertion is frankly
> pointless.
> 
> I could equally perform my own 'static analysis' and deduce that the
> default case there is redundant and delete it:)
> 


Of course for our code all cases are covered - and as I've mentioned  -
sometimes the analyzer is not yet skilled enough to recognize that all
use-cases of the function are already covered and there cannot be any misusage
as the function is invoked only locally (static) - but usually all 'asserts()'
are about something which should never happen :)

Anyway I'll open another Clang bug for this case.

(as you may see I'm usually being suggested to cover the problematic case by
adding asserts (i.e. see http://llvm.org/bugs/show_bug.cgi?id=8697))

It's about whether we want to get all these 'easy-to-hide' false positives
again with next round check - so anyone who will look into the result of
analyzer will need to go through the list of 'old known' problems - or just
directly see a new problem - i.e. having multiple pages of issues where some
of them are known false positives - currently with my local tree I get just
23 reports - which is pretty small list)

It's not a problem to keep these little quirks only in my local tree (except
we wont get cleaner Coverity reports as that one is made with CVS tree).

Zdenek





More information about the lvm-devel mailing list