Re: [PATCH 1/7] staging: rtl8723bs: os_dep: remove set but not used 'uintRet'

From: Greg KH
Date: Tue Apr 28 2020 - 08:27:45 EST


On Mon, Apr 27, 2020 at 11:23:36AM +0800, Jason Yan wrote:
> Fix the following gcc warning:
>
> drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:2564:22: warning:
> variable âuintRetâ set but not used [-Wunused-but-set-variable]
> unsigned int uintRet = 0;
> ^~~~~~~
>
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: Jason Yan <yanaijie@xxxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index 5059b874080e..902ac8169948 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -2561,14 +2561,16 @@ static int rtw_wps_start(struct net_device *dev,
> struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
> struct iw_point *pdata = &wrqu->data;
> u32 u32wps_start = 0;
> - unsigned int uintRet = 0;
>
> if ((true == padapter->bDriverStopped) || (true == padapter->bSurpriseRemoved) || (NULL == pdata)) {
> ret = -EINVAL;
> goto exit;
> }
>
> - uintRet = copy_from_user((void *)&u32wps_start, pdata->pointer, 4);
> + if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4)) {
> + ret = -EFAULT;
> + goto exit;
> + }

This also fixes the issue of copy_from_user not being checked, nice!

greg k-h