Re: [PATCH] staging/iio: Use correct argument for sizeof

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/22/2013 07:43 AM, Dan Carpenter wrote:
> On Mon, Jan 21, 2013 at 10:14:02PM +0100, Peter Huewe wrote:
>> found with coccicheck
>> sizeof when applied to a pointer typed expression gives the size of
>> the pointer
>>
> 
> The original code is correct, in this case.  We're storing an array
> of pointers and the last element in the array is a NULL.
> 

The patch changed sizeof(st->attrs) to sizeof(*st->attrs). The type of
st->attrs is struct attribute **, so both sizeofs return the same value (the
size of an pointer) and the code happens to work, still the later is
semantically more correct.


>> The semantic patch that makes this output is available
>> in scripts/coccinelle/misc/noderef.cocci.
>>
>> More information about semantic patching is available at
>> http://coccinelle.lip6.fr/
> 
> Can you remove those two boiler plate lines?  We all have google.

It would be nice to have a pointer to the specific cocci script used to
generate the patch though.

- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux