From: Pavel Skripkin <paskripkin@gmail.com>
To: cgel.zte@gmail.com, gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
xu xin <xu.xin16@zte.com.cn>, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH Linux-next] ioctl_linux: fix a potential NULL pointer dereference bug
Date: Mon, 23 Aug 2021 22:34:54 +0300 [thread overview]
Message-ID: <23609ad3-68bb-6df6-609d-5630597c7e0f@gmail.com> (raw)
In-Reply-To: <20210823030631.45517-1-xu.xin16@zte.com.cn>
On 8/23/21 6:06 AM, cgel.zte@gmail.com wrote:
> From: xu xin <xu.xin16@zte.com.cn>
>
> The pointer might be NULL, but it is dereferenced.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---
> drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> index a3e6d761e748..ce4ce9190f5f 100644
> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> @@ -4389,7 +4389,8 @@ static int rtw_dbg_port(struct net_device *dev,
> pregpriv->rx_stbc = extra_arg;
> DBG_88E("set rx_stbc =%d\n", pregpriv->rx_stbc);
> } else {
> - DBG_88E("get rx_stbc =%d\n", pregpriv->rx_stbc);
> + if (pregpriv)
> + DBG_88E("get rx_stbc =%d\n", pregpriv->rx_stbc);
> }
> }
> break;
> @@ -4401,7 +4402,8 @@ static int rtw_dbg_port(struct net_device *dev,
> pregpriv->ampdu_enable = extra_arg;
> DBG_88E("set ampdu_enable =%d\n", pregpriv->ampdu_enable);
> } else {
> - DBG_88E("get ampdu_enable =%d\n", pregpriv->ampdu_enable);
> + if (pregpriv)
> + DBG_88E("get ampdu_enable =%d\n", pregpriv->ampdu_enable);
> }
> }
> break;
>
Hi, Xu!
I can't see how pregpriv can be NULL:
struct registry_priv *pregpriv = &padapter->registrypriv;
It can be NULL in case of completely wrong padapter pointer, but I can't
see how it's possible. Do you have a calltrace?
I guess, your robot reported this, because there is useless check in
same code block:
if (pregpriv &&
(extra_arg == 0 ||
extra_arg == 1 ||
extra_arg == 2 ||
extra_arg == 3))
So, I think, "pregpriv &&" part should be removed, instead of adding 2
branches.
Also, subject line should be "staging: r8118eu: <subject>". Thank you!
With regards,
Pavel Skripkin
prev parent reply other threads:[~2021-08-23 19:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 3:06 cgel.zte
2021-08-23 19:34 ` Pavel Skripkin [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=23609ad3-68bb-6df6-609d-5630597c7e0f@gmail.com \
--to=paskripkin@gmail.com \
--cc=cgel.zte@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=xu.xin16@zte.com.cn \
--cc=zealci@zte.com.cn \
/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®