Skip to content

Commit

Permalink
mwifiex: fix potential null dereference 'mef_entry'
Browse files Browse the repository at this point in the history
drivers/net/wireless/mwifiex/cfg80211.c:2357 mwifiex_cfg80211_suspend()
  error: potential null dereference 'mef_entry'
  (kzalloc returns null)

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Bing Zhao authored and John W. Linville committed Mar 8, 2013
1 parent 8908c7d commit c678fb2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/wireless/mwifiex/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c678fb2

Please sign in to comment.