Skip to contentSkip to conversation

mwifiex: potential corruption in mwifiex_update_uap_custom_ie()

PATCH In review Dan Carpenter 2 participants 2 messages Sep 23, 2012 – Sep 24, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mwifiex: potential corruption in mwifiex_update_uap_custom_ie()

ap_custom_ie is a struct mwifiex_ie_list which is quite different and also larger than struct mwifiex_ie. It's a difference between 4196 bytes and 262.

---
This is a static checker fix and I don't have the hardware to test it. Please review it carefully.

drivers/net/wireless/mwifiex/ie.c +1 -1
index 1d8dd00..fa3a80f 100644
@@ -160,7 +160,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
 	u16 len;
 	int ret;
 
-	ap_custom_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
+	ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL);
 	if (!ap_custom_ie)
 		return -ENOMEM;
 
Tested-by Stone Piao Acked-by on v1 1/1
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 5 lines

ap_custom_ie is a struct mwifiex_ie_list which is quite different and also larger than struct mwifiex_ie. It's a difference between 4196 bytes and 262.

Thanks,
Bing

Quoted 17 lines

---
This is a static checker fix and I don't have the hardware to test it. Please review it carefully.

drivers/net/wireless/mwifiex/ie.c +1 -1
index 1d8dd00..fa3a80f 100644
@@ -160,7 +160,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
 	u16 len;
 	int ret;
 
-	ap_custom_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
+	ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL);
 	if (!ap_custom_ie)
 		return -ENOMEM;