Skip to content

Commit

Permalink
fuse: Convert to kstrtoul_from_user
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Peter Huewe authored and Miklos Szeredi committed Apr 25, 2012
1 parent 66f75a5 commit e269069
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions fs/fuse/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e269069

Please sign in to comment.