linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: devel@driverdev.osuosl.org, linux-iio@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Jonathan Cameron <jic23@cam.ac.uk>
Subject: Re: [PATCH] staging/iio: Use correct argument for sizeof
Date: Tue, 22 Jan 2013 11:05:26 +0300	[thread overview]
Message-ID: <20130122080525.GX4584@mwanda> (raw)
In-Reply-To: <50FE477D.7060401@metafoo.de>

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


  reply	other threads:[~2013-01-22  8:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 21:14 [PATCH] staging/iio: Use correct argument for sizeof Peter Huewe
2013-01-22  6:43 ` Dan Carpenter
2013-01-22  7:02   ` Dan Carpenter
2013-01-22  8:02   ` Lars-Peter Clausen
2013-01-22  8:05     ` Dan Carpenter [this message]
2013-01-22 11:58 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130122080525.GX4584@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).