diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2011-08-03 16:44:29 +0200 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 16:44:20 +0200 |
commit | d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec (patch) | |
tree | d934fccc4fd2748a20610191f5b4c8e1601fc646 /drivers/s390 | |
parent | [S390] exec: remove redundant set_fs(USER_DS) (diff) | |
download | linux-d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec.tar.xz linux-d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec.zip |
[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: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/sclp_async.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index 7ad30e72f868..5f9f929e891c 100644 --- a/drivers/s390/char/sclp_async.c +++ b/drivers/s390/char/sclp_async.c @@ -82,12 +82,9 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write, return -EFAULT; } else { len = *count; - rc = copy_from_user(buf, buffer, sizeof(buf)); - if (rc != 0) - return -EFAULT; - buf[sizeof(buf) - 1] = '\0'; - if (strict_strtoul(buf, 0, &val) != 0) - return -EINVAL; + rc = kstrtoul_from_user(buffer, len, 0, &val); + if (rc) + return rc; if (val != 0 && val != 1) return -EINVAL; callhome_enabled = val; |