提交 d5f4d113 编写于 作者: P Peter Huewe 提交者: Heiko Carstens

[S390] sclp_async: Use kstrtoul_from_user

This patch replaces the code for getting an unsigned long 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: NHeiko Carstens <heiko.carstens@de.ibm.com>
上级 ada5ed54
...@@ -82,12 +82,9 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write, ...@@ -82,12 +82,9 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
return -EFAULT; return -EFAULT;
} else { } else {
len = *count; len = *count;
rc = copy_from_user(buf, buffer, sizeof(buf)); rc = kstrtoul_from_user(buffer, len, 0, &val);
if (rc != 0) if (rc)
return -EFAULT; return rc;
buf[sizeof(buf) - 1] = '\0';
if (strict_strtoul(buf, 0, &val) != 0)
return -EINVAL;
if (val != 0 && val != 1) if (val != 0 && val != 1)
return -EINVAL; return -EINVAL;
callhome_enabled = val; callhome_enabled = val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册