mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nathan Chancellor <natechancellor@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
Date: Thu, 21 Mar 2019 00:51:17 +0530	[thread overview]
Message-ID: <b21893ef-6326-fef0-9e3f-60627d58b12d@codeaurora.org> (raw)
In-Reply-To: <20190320154234.29242-1-pakki001@umn.edu>


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

Thanks,
Mukesh



      reply	other threads:[~2019-03-20 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 15:42 Aditya Pakki
2019-03-20 19:21 ` Mukesh Ojha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b21893ef-6326-fef0-9e3f-60627d58b12d@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=pakki001@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®