From: Julia Lawall <julia@diku.dk>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: kernel-janitors@vger.kernel.org,
Ian Campbell <ian.campbell@citrix.com>,
Jan Beulich <jbeulich@novell.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] drivers/block/xen-blkback/blkback.c: take size of pointed value, not pointer
Date: Fri, 16 Sep 2011 08:57:32 +0200 [thread overview]
Message-ID: <1316156255-19509-1-git-send-email-julia@diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
Sizeof a pointer-typed expression returns the size of the pointer, not that
of the pointed data.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression *e;
type T;
identifier f;
@@
f(...,(T)e,...,
-sizeof(e)
+sizeof(*e)
,...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/block/xen-blkback/blkback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -790,7 +790,7 @@ static int __init xen_blkif_init(void)
if (rc)
goto failed_init;
- memset(blkbk->pending_reqs, 0, sizeof(blkbk->pending_reqs));
+ memset(blkbk->pending_reqs, 0, sizeof(*blkbk->pending_reqs));
INIT_LIST_HEAD(&blkbk->pending_free);
spin_lock_init(&blkbk->pending_free_lock);
next reply other threads:[~2011-09-16 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 6:57 Julia Lawall [this message]
2011-09-16 7:38 ` [PATCH 1/4] drivers/block/xen-blkback/blkback.c: take size of pointed value, not pointer Jan Beulich
2011-09-16 8:08 ` Julia Lawall
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=1316156255-19509-1-git-send-email-julia@diku.dk \
--to=julia@diku.dk \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@novell.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=konrad.wilk@oracle.com \
--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