Re: [PATCH 2/2] staging: rtl8188eu: Fix private WEXT IOCTL calls

From: Dan Carpenter
Date: Fri Nov 24 2017 - 23:40:41 EST


Thanks for doing this.

This needs to be folded in with the earlier patch you send and then
resend it as a V2 patch.
https://kernelnewbies.org/FirstKernelPatch#head-5c81b3c517a1d0bbc24f92594cb734e155fcbbcb

I added Johannes to the CC list again because this is sort of his
fault... To be honest, I'm a little bit puzzled. I would have thought
Johannes's change would have made some code unused and that we could
delete it now. I haven't looked at this.

>
> - if (ret == 0 && (copy_to_user(wrqu->data.pointer, param, wrqu->data.length)))
> + if (pmlmepriv->htpriv.ht_option == false)
> + psta->htpriv.ht_option = false;
> +
> + update_sta_info_apmode(padapter, psta);
> +
> + ret = 0;
> +
> + if (copy_to_user(wrqu->data.pointer, param, wrqu->data.length))
> ret = -EFAULT;
>
> - return ret;
> + err_free_param:
> + kfree(param);
> + return ret;
> }

Please keep the success path and failure paths separate like I did in
the example code that I wrote in my email. Don't indent the labels. It
should look like this:

update_sta_info_apmode(padapter, psta);

if (copy_to_user(wrqu->data.pointer, param, wrqu->data.length)) {
ret = -EFAULT;
goto err_free_param;
}

kfree(param);
return 0;

err_free_param:
kfree(param);
return ret;

regards,
dan carpenter