[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130122080525.GX4584@mwanda>
Date: Tue, 22 Jan 2013 11:05:26 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: devel@...verdev.osuosl.org, linux-iio@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Jonathan Cameron <jic23@....ac.uk>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists