Skip to content

Commit e269069

Browse files
PeterHueweMiklos Szeredi
authored andcommitted
fuse: Convert to kstrtoul_from_user
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>
1 parent 66f75a5 commit e269069

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎fs/fuse/control.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,13 @@ static ssize_t fuse_conn_limit_write(struct file *file, const char __user *buf,
7575
unsigned global_limit)
7676
{
7777
unsigned long t;
78-
char tmp[32];
7978
unsigned limit = (1 << 16) - 1;
8079
int err;
8180

82-
if (*ppos || count >= sizeof(tmp) - 1)
83-
return -EINVAL;
84-
85-
if (copy_from_user(tmp, buf, count))
81+
if (*ppos)
8682
return -EINVAL;
8783

88-
tmp[count] = '\0';
89-
90-
err = strict_strtoul(tmp, 0, &t);
84+
err = kstrtoul_from_user(buf, count, 0, &t);
9185
if (err)
9286
return err;
9387

0 commit comments

Comments
 (0)