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] staging: rtlwifi: Fix potential NULL pointer dereference
Date: Wed, 20 Mar 2019 18:42:45 +0530 [thread overview]
Message-ID: <4c393bbd-9d93-6f6e-fc82-133304cfdf69@codeaurora.org> (raw)
In-Reply-To: <20190313161336.20182-1-pakki001@umn.edu>
On 3/13/2019 9:43 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.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/staging/rtlwifi/phydm/rtl_phydm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> index 9930ed954abb..37c7fcb72b65 100644
> --- a/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> +++ b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> @@ -181,6 +181,9 @@ 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;
> +
Although, it is good to add a check but nobody is checking this
functions returned value.
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Can you fix that cleanly ? Otherwise i will do.
Cheers,
Mukesh
> _rtl_phydm_init_com_info(rtlpriv, ic, params);
>
> odm_init_all_timers(dm);
next prev parent reply other threads:[~2019-03-20 13:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-13 16:13 [PATCH] staging: rtlwifi: Fix potential NULL pointer dereference Aditya Pakki
2019-03-20 10:38 ` Dan Carpenter
2019-03-20 13:12 ` Mukesh Ojha [this message]
2019-03-20 15:06 ` Mukesh Ojha
2019-03-13 16:29 Aditya Pakki
2019-03-17 11:13 ` Greg Kroah-Hartman
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=4c393bbd-9d93-6f6e-fc82-133304cfdf69@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;
as well as URLs for NNTP newsgroup(s).