[Linux-kernel-mentees] [PATCH] staging: rtl8723bs: change sscanf to kstrtoint

Greg KH gregkh at linuxfoundation.org
Sat Jun 22 07:38:37 UTC 2019


On Sat, Jun 22, 2019 at 01:01:58PM +0530, Harshavardhan Unnibhavi wrote:
> Fixes following checkpath.pl warning:
> Prefer kstrto<type> to single variable sscanf
> 
> Signed-off-by: Harshavardhan Unnibhavi <hvubfoss at gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c
> index 5f950fda48ea..b700363c899c 100644
> --- a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c
> +++ b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c
> @@ -468,7 +468,7 @@ ssize_t proc_set_odm_dbg_comp(struct file *file, const char __user *buffer, size
>  
>  	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
>  
> -		int num = sscanf(tmp, "%llx", &dbg_comp);
> +		int num = kstrtoint(tmp, "%llx", &dbg_comp);

If the conversion was this easy, we would have done it with a global
search/replace a long time ago :)

Are you _sure_ this is correct?

thanks,

greg k-h


More information about the Linux-kernel-mentees mailing list