[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190319201509.16252-1-pakki001@umn.edu>
Date: Tue, 19 Mar 2019 15:15:08 -0500
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nathan Chancellor <natechancellor@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2] 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.
--
v1: Patch collision with different things, fix as per Greg
Signed-off-by: Aditya Pakki <pakki001@....edu>
---
drivers/staging/rtlwifi/phydm/rtl_phydm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
index 9930ed954abb..a7932706f286 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,
rtlpriv->phydm.internal =
kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL);
+ if (!rtlpriv->phydm.internal)
+ return -ENOMEM;
_rtl_phydm_init_com_info(rtlpriv, ic, params);
--
2.17.1
Powered by blists - more mailing lists