Skip to contentSkip to conversation

mwifiex: fix potential null dereference 'mef_entry'

PATCH New Bing Zhao 1 participant 1 message Mar 7, 2013 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 mwifiex: fix potential null dereference 'mef_entry'

drivers/net/wireless/mwifiex/cfg80211.c:2357 mwifiex_cfg80211_suspend()
error: potential null dereference 'mef_entry'
(kzalloc returns null)

---
 drivers/net/wireless/mwifiex/cfg80211.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +4 -1
index df30107..c9bc5f5 100644
@@ -2350,9 +2350,12 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
 		return 0;
 	}
 
+	mef_entry = kzalloc(sizeof(*mef_entry), GFP_KERNEL);
+	if (!mef_entry)
+		return -ENOMEM;
+
 	memset(&mef_cfg, 0, sizeof(mef_cfg));
 	mef_cfg.num_entries = 1;
-	mef_entry = kzalloc(sizeof(*mef_entry), GFP_KERNEL);
 	mef_cfg.mef_entry = mef_entry;
 	mef_entry->mode = MEF_MODE_HOST_SLEEP;
 	mef_entry->action = MEF_ACTION_ALLOW_AND_WAKEUP_HOST;
Signature · 1 line
1.7.0.2