提交 e2690695 编写于 作者: P Peter Huewe 提交者: Miklos Szeredi

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: NPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
上级 66f75a5d
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册