public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
	yongjun_wei@trendmicro.com.cn, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start()
Date: Sun, 07 Oct 2012 20:04:22 -0500	[thread overview]
Message-ID: <50722696.4090100@lwfinger.net> (raw)
In-Reply-To: <CAPgLHd8d0v6fjMGJnK2LbRWTyhRh4DQXXNyxWo10=0Y+GVk7FA@mail.gmail.com>

On 10/07/2012 07:43 PM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> The dereference should be moved below the NULL test.
>
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>   drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks,

Larry

>
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> index c9a6a7f..3a64790 100644
> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -2110,10 +2110,10 @@ static int r871x_wps_start(struct net_device *dev,
>   	struct iw_point *pdata = &wrqu->data;
>   	u32   u32wps_start = 0;
>
> -	if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
> -		return -EFAULT;
>   	if ((padapter->bDriverStopped) || (pdata == NULL))
>   		return -EINVAL;
> +	if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
> +		return -EFAULT;
>   	if (u32wps_start == 0)
>   		u32wps_start = *extra;
>   	if (u32wps_start == 1) /* WPS Start */
>
>


      reply	other threads:[~2012-10-08  1:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08  0:43 [PATCH] staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start() Wei Yongjun
2012-10-08  1:04 ` Larry Finger [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=50722696.4090100@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=weiyj.lk@gmail.com \
    --cc=yongjun_wei@trendmicro.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