From: Jes Sorensen Date: Sat, 26 Apr 2014 16:54:56 +0000 (+0200) Subject: staging: rtl8723au: cfg80211_rtw_add_key() return -ENOMEM on kmalloc failure X-Git-Tag: next-20140428~14^2~100 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6f1c59bf2c00eeba0f9ad9ce176cce731de1a8e5;p=karo-tx-linux.git staging: rtl8723au: cfg80211_rtw_add_key() return -ENOMEM on kmalloc failure Reported-by: Dan Carpenter Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 74ac86a0333f..0866ab59a399 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1077,7 +1077,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, { char *alg_name; u32 param_len; - struct ieee_param *param = NULL; + struct ieee_param *param; int ret = 0; struct wireless_dev *rtw_wdev = wiphy_to_wdev(wiphy); struct rtw_adapter *padapter = wiphy_to_adapter(wiphy); @@ -1093,8 +1093,8 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, param_len = sizeof(struct ieee_param) + params->key_len; param = kzalloc(param_len, GFP_KERNEL); - if (param == NULL) - return -1; + if (!param) + return -ENOMEM; param->cmd = IEEE_CMD_SET_ENCRYPTION; eth_broadcast_addr(param->sta_addr);