Skip to contentSkip to conversation

mpt2sas: Fix memset using sizeof(ptr) not sizeof(*ptr)

PATCH Superseded Joe Perches 1 participant 1 message May 9, 2011 SCSI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpt2sas: Fix memset using sizeof(ptr) not sizeof(*ptr)

Found via coccinelle script

@@
type T;
T* ptr;
expression E1;
@@

* memset(E1, 0, sizeof(ptr));

---
 drivers/scsi/mpt2sas/mpt2sas_transport.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_transport.c +1 -1
index cb1cdec..9e86708 100644
@@ -163,7 +163,7 @@ _transport_set_identify(struct MPT2SAS_ADAPTER *ioc, u16 handle,
 		return -EIO;
 	}
 
-	memset(identify, 0, sizeof(identify));
+	memset(identify, 0, sizeof(*identify));
 	device_info = le32_to_cpu(sas_device_pg0.DeviceInfo);
 
 	/* sas_address */