diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-20 11:42:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-21 03:32:58 -0400 |
commit | 6a8ca24590a2136921439b376c926c11a6effc0e (patch) | |
tree | d85264722e8e6ae272a952392447763c76a40488 | |
parent | 22c971db7dd4b0ad8dd88e99c407f7a1f4231a2e (diff) |
staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
phydm.internal is allocated using kzalloc which is used multiple
times without a check for NULL pointer. This patch avoids such a
scenario by returning 0, consistent with the failure case.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rtlwifi/phydm/rtl_phydm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c index 9930ed954abb..4cc77b2016e1 100644 --- a/drivers/staging/rtlwifi/phydm/rtl_phydm.c +++ b/drivers/staging/rtlwifi/phydm/rtl_phydm.c | |||
@@ -180,6 +180,8 @@ static int rtl_phydm_init_priv(struct rtl_priv *rtlpriv, | |||
180 | 180 | ||
181 | rtlpriv->phydm.internal = | 181 | rtlpriv->phydm.internal = |
182 | kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL); | 182 | kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL); |
183 | if (!rtlpriv->phydm.internal) | ||
184 | return 0; | ||
183 | 185 | ||
184 | _rtl_phydm_init_com_info(rtlpriv, ic, params); | 186 | _rtl_phydm_init_com_info(rtlpriv, ic, params); |
185 | 187 | ||