Skip to contentSkip to conversation

Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().

PATCH In review Sandhya Bankar 2 participants 2 messages Mar 8, 2016 – Mar 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().

Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().

---
Changes in v2:
* No change.
*Compile this patch to check nothing is broken.

 drivers/staging/slicoss/slicoss.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/slicoss/slicoss.c +3 -3
index acf73f0..ed1c067 100644
@@ -880,7 +880,7 @@ static int slic_upr_queue_request(struct adapter *adapter,
 	struct slic_upr *upr;
 	struct slic_upr *uprqueue;
 
-	upr = kmalloc(sizeof(struct slic_upr), GFP_ATOMIC);
+	upr = kmalloc(sizeof(*upr), GFP_ATOMIC);
 	if (!upr)
 		return -ENOMEM;
 
@@ -1806,7 +1806,7 @@ static int slic_mcast_add_list(struct adapter *adapter, char *address)
 	}
 
 	/* Doesn't already exist.  Allocate a structure to hold it */
-	mcaddr = kmalloc(sizeof(struct mcast_address), GFP_ATOMIC);
+	mcaddr = kmalloc(sizeof(*mcaddr), GFP_ATOMIC);
 	if (!mcaddr)
 		return 1;
 
@@ -3049,7 +3049,7 @@ static u32 slic_card_locate(struct adapter *adapter)
 	}
 	if (!physcard) {
 		/* no structure allocated for this physical card yet */
-		physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
+		physcard = kzalloc(sizeof(*physcard), GFP_ATOMIC);
 		if (!physcard) {
 			if (card_hostid == SLIC_HOSTID_DEFAULT)
 				kfree(card);
Signature · 1 line
1.8.3.4
maintainer
#1 lore raw
Quoted 7 lines · Sandhya Bankar

Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().

---
Changes in v2:
* No change.
*Compile this patch to check nothing is broken.

Does not apply to my tree :(