lkml.org 
[lkml]   [2013]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging/iio: Use correct argument for sizeof
On Tue, Jan 22, 2013 at 09:02:05AM +0100, Lars-Peter Clausen wrote:
> 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.
>

Yeah. You're right, my bad. The patch is fine.

regards,
dan carpenter



\
 
 \ /
  Last update: 2013-01-22 09:46    [W:0.066 / U:1.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site