linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
@ 2019-03-19 20:15 Aditya Pakki
  2019-03-20  7:23 ` Greg Kroah-Hartman
  2019-03-21  7:20 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-03-19 20:15 UTC (permalink / raw)
  To: pakki001; +Cc: kjlu, Greg Kroah-Hartman, Nathan Chancellor, devel, linux-kernel

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@umn.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
  2019-03-19 20:15 [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc Aditya Pakki
@ 2019-03-20  7:23 ` Greg Kroah-Hartman
  2019-03-21  7:20 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-20  7:23 UTC (permalink / raw)
  To: Aditya Pakki; +Cc: kjlu, Nathan Chancellor, devel, linux-kernel

On Tue, Mar 19, 2019 at 03:15:08PM -0500, Aditya Pakki wrote:
> 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@umn.edu>

signed-off-by has to be above the -- line.  Please fix.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
  2019-03-19 20:15 [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc Aditya Pakki
  2019-03-20  7:23 ` Greg Kroah-Hartman
@ 2019-03-21  7:20 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-03-21  7:20 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: devel, Greg Kroah-Hartman, Nathan Chancellor, kjlu, linux-kernel

On Tue, Mar 19, 2019 at 03:15:08PM -0500, Aditya Pakki wrote:
> 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@umn.edu>
> ---

Gar...  Sorry, no, that's not quite right.  It should be:

blah blah blah...

Signed-off-by: you
---
V1: Patch collision with different things, fix as per Greg

Try applying your patch with `cat raw_email.txt | git am` and you'll see
the problem with the commit message.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-21  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 20:15 [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc Aditya Pakki
2019-03-20  7:23 ` Greg Kroah-Hartman
2019-03-21  7:20 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).