diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2011-08-03 10:44:29 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 10:44:20 -0400 |
commit | d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec (patch) | |
tree | d934fccc4fd2748a20610191f5b4c8e1601fc646 /drivers/s390/char | |
parent | ada5ed5484f492e4eb13d788c6c077cf243f53e6 (diff) |
[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/char')
-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, | |||
82 | return -EFAULT; | 82 | return -EFAULT; |
83 | } else { | 83 | } else { |
84 | len = *count; | 84 | len = *count; |
85 | rc = copy_from_user(buf, buffer, sizeof(buf)); | 85 | rc = kstrtoul_from_user(buffer, len, 0, &val); |
86 | if (rc != 0) | 86 | if (rc) |
87 | return -EFAULT; | 87 | return rc; |
88 | buf[sizeof(buf) - 1] = '\0'; | ||
89 | if (strict_strtoul(buf, 0, &val) != 0) | ||
90 | return -EINVAL; | ||
91 | if (val != 0 && val != 1) | 88 | if (val != 0 && val != 1) |
92 | return -EINVAL; | 89 | return -EINVAL; |
93 | callhome_enabled = val; | 90 | callhome_enabled = val; |