[flashrom] [PATCH] CID1130005: Array compared against 0

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu May 8 22:51:43 CEST 2014


Am 08.05.2014 18:56 schrieb Stefan Tauner:
> On Tue, 19 Nov 2013 20:35:57 +0100
> Stefan Reinauer <stefan.reinauer at coreboot.org> wrote:
>
>> > CID1130005: Array compared against 0
>> > 
>> > The address of an array is never NULL, so the comparison will always evaluate
>> > the same way.
>> > In selfcheck: Array compared against NULL pointer
>> > 
>> > Since the array is defined unconditionally in C code the check does not really
>> > make sense. It might make more sense to check whether there are entries in the
>> > array, but that is not required on all platforms so far.
> Thanks for reporting this. I have attached by approach to fix this.
> IMHO it makes no sense to check the array outside its compilation unit.
> That's just stupid. Instead I move the checks of the flashchips array
> from flashrom.c to flashchips.c and remove all others that are futile
> anyway.

NACK. flashchips.c should only have data, not code. We might want to
guard against an array which is not terminated with an empty (NULL/0)
member, but checking if the pointer is NULL is indeed not needed.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list