[PATCH] ccan: Fix calling memset with zero length parameter.
rusty at rustcorp.com.au
Sun Jul 14 23:12:03 MDT 2013
Volker Lendecke <Volker.Lendecke at SerNet.DE> writes:
> On Thu, Jul 11, 2013 at 02:04:00PM +0200, Andreas Schneider wrote:
>> 2381 from ../lib/ccan/likely/likely.h:5,
>> 2382 from ../lib/ccan/tally/tally.c:4:
>> 2383 In function 'memset',
>> 2384 inlined from 'tally_histogram' at ../lib/ccan/tally/tally.c:513:9:
>> 2385 /usr/include/bits/string3.h:81:30: warning: call to
>> '__warn_memset_zero_len' declared with attribute warning: memset used with
>> constant zero length parameter; this could be due to transposed parameters
>> [enabled by default]
>> 2386 __warn_memset_zero_len ();
>> 2387 ^
>> I didn't see how could could be always 0 here but probably count = 0 is what
>> the compiler sees and warns about.
> To avoid an additional if-statement, what about the
> alternative attached patch?
Yes, I like this. Though it's really a false positive from GCC.
I've applied the same patch to upstream CCAN.
More information about the samba-technical