Re: [PATCH] fs/fuse: Convert to kstrtoul_from_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Peter Huewe <peterhuewe@xxxxxx> writes:

> This patch replaces the code for getting an number from a
> userspace buffer by a simple call to kstroul_from_user.
> This makes it easier to read and less error prone.

Thanks, applied.

Miklos

>
> Signed-off-by: Peter Huewe <peterhuewe@xxxxxx>
> ---
>  fs/fuse/control.c |   10 ++--------
>  1 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/fs/fuse/control.c b/fs/fuse/control.c
> index 42593c5..03ff5b1 100644
> --- a/fs/fuse/control.c
> +++ b/fs/fuse/control.c
> @@ -75,19 +75,13 @@ static ssize_t fuse_conn_limit_write(struct file *file, const char __user *buf,
>  				     unsigned global_limit)
>  {
>  	unsigned long t;
> -	char tmp[32];
>  	unsigned limit = (1 << 16) - 1;
>  	int err;
>  
> -	if (*ppos || count >= sizeof(tmp) - 1)
> -		return -EINVAL;
> -
> -	if (copy_from_user(tmp, buf, count))
> +	if (*ppos)
>  		return -EINVAL;
>  
> -	tmp[count] = '\0';
> -
> -	err = strict_strtoul(tmp, 0, &t);
> +	err = kstrtoul_from_user(buf, count, 0, &t);
>  	if (err)
>  		return err;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]     [Free Dating]

Add to Google Powered by Linux