* [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size of pointed value, not pointer
@ 2011-09-16 6:57 Julia Lawall
2011-09-16 16:32 ` [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2011-09-16 6:57 UTC (permalink / raw)
To: James E.J. Bottomley
Cc: kernel-janitors, Kashyap Desai, James Bottomley, linux-scsi,
linux-kernel
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/scsi/mpt2sas/mpt2sas_transport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -163,7 +163,7 @@ _transport_set_identify(struct MPT2SAS_A
return -EIO;
}
- memset(identify, 0, sizeof(identify));
+ memset(identify, 0, sizeof(*identify));
device_info = le32_to_cpu(sas_device_pg0.DeviceInfo);
/* sas_address */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size
2011-09-16 6:57 [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size of pointed value, not pointer Julia Lawall
@ 2011-09-16 16:32 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2011-09-16 16:32 UTC (permalink / raw)
To: Julia Lawall
Cc: James E.J. Bottomley, kernel-janitors, Kashyap Desai,
James Bottomley, linux-scsi, linux-kernel
On Fri, 2011-09-16 at 08:57 +0200, Julia Lawall wrote:
> Sizeof a pointer-typed expression returns the size of the pointer, not that
> of the pointed data.
Hi Julia.
I submitted the same thing in May.
I hope it takes this time.
https://lkml.org/lkml/2011/5/9/31
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-16 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-16 6:57 [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size of pointed value, not pointer Julia Lawall
2011-09-16 16:32 ` [PATCH 3/4] drivers/scsi/mpt2sas/mpt2sas_transport.c: take size Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox