[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b21893ef-6326-fef0-9e3f-60627d58b12d@codeaurora.org>
Date: Thu, 21 Mar 2019 00:51:17 +0530
From: Mukesh Ojha <mojha@...eaurora.org>
To: Aditya Pakki <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: Re: [PATCH v3] staging: rtlwifi: Fix potential NULL pointer
dereference of kzalloc
On 3/20/2019 9:12 PM, 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 by returning 0, consistent with the failure case.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
>
> ---
> v2: Move the signed off line above
> v1: Patch collision with different things, fix as per Greg
> ---
> 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..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,
>
> rtlpriv->phydm.internal =
> kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL);
> + if (!rtlpriv->phydm.internal)
> + return 0;
>
> _rtl_phydm_init_com_info(rtlpriv, ic, params);
>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
Thanks,
Mukesh
Powered by blists - more mailing lists