Skip to contentSkip to conversation

staging: rtl8192e: use structure pointer to get the size of the structure

PATCH Superseded Santha Meena Ramamoorthy 2 participants 2 messages Feb 24, 2018 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: use structure pointer to get the size of the structure

Use pointer to the structure to get the size of the structure. Issue found using checkpatch.

---
 drivers/staging/rtl8192e/rtllib_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_wx.c +1 -1
index 03fbff0..bd06bec 100644
@@ -371,7 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		struct lib80211_crypt_data *new_crypt;
 
 		/* take WEP into use */
-		new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
+		new_crypt = kzalloc(sizeof(*new_crypt),
 				    GFP_KERNEL);
 		if (new_crypt == NULL)
 			return -ENOMEM;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 13 lines · Santha Meena Ramamoorthy

Use pointer to the structure to get the size of the structure. Issue found using checkpatch.

---
 drivers/staging/rtl8192e/rtllib_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_wx.c +0 -0
index 03fbff0..bd06bec 100644

drivers/staging/rtl8192e/rtllib_wx.c int rtllib_wx_set_encode(struct rtllib_device *ieee, · line 375

Quoted 6 lines
drivers/staging/rtl8192e/rtllib_wx.c +1 -1
@@ -371,7 +371,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 		struct lib80211_crypt_data *new_crypt;
 
 		/* take WEP into use */
-		new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
+		new_crypt = kzalloc(sizeof(*new_crypt),
 				    GFP_KERNEL);

You could now move the GFP_KERNEL up to the previous line, since there is plenty of room.

julia

Quoted 12 lines
drivers/staging/rtl8192e/rtllib_wx.c +0 -1
 		if (new_crypt == NULL)
 			return -ENOMEM;
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519504330-9936-1-git-send-email-santhameena13%40gmail.com.
For more options, visit https://groups.google.com/d/optout.