From: Lars-Peter Clausen <lars@metafoo.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Jonathan Cameron <jic23@cam.ac.uk>,
linux-iio@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging/iio: Use correct argument for sizeof
Date: Tue, 22 Jan 2013 09:02:05 +0100 [thread overview]
Message-ID: <50FE477D.7060401@metafoo.de> (raw)
In-Reply-To: <20130122064351.GV4584@mwanda>
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
next prev parent reply other threads:[~2013-01-22 8:00 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 [this message]
2013-01-22 8:05 ` Dan Carpenter
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=50FE477D.7060401@metafoo.de \
--to=lars@metafoo.de \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.