public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start()
@ 2012-10-08  0:43 Wei Yongjun
  2012-10-08  1:04 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-10-08  0:43 UTC (permalink / raw)
  To: Larry.Finger, florian.c.schilhabel, gregkh
  Cc: yongjun_wei, devel, linux-kernel

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(-)

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 */


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2012-10-08  1:04 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: florian.c.schilhabel, gregkh, yongjun_wei, devel, linux-kernel

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 */
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-08  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox