drivers/scsi/mpt2sas/mpt2sas_transport.c: take size of pointed value, not pointer
Subsystems (2)
PATCH 3/4 drivers/scsi/mpt2sas/mpt2sas_transport.c: take size of pointed value, not pointer
From: Julia Lawall <[email protected]>
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 <[email protected]>
--- drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpt2sas/mpt2sas_transport.c +1 -1
@@ -163,7 +163,7 @@ _transport_set_identify(struct MPT2SAS_Areturn -EIO ; } -memset (identify,0 ,sizeof (identify)); +memset (identify,0 ,sizeof (*identify)); device_info =le32_to_cpu (sas_device_pg0.DeviceInfo);/* sas_address */
Quoted 2 lines · Julia Lawall
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.