Commit d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec
Committed by
Heiko Carstens
1 parent
ada5ed5484
Exists in
master
and in
20 other branches
[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>
Showing 1 changed file with 3 additions and 6 deletions Side-by-side Diff
drivers/s390/char/sclp_async.c
... | ... | @@ -82,12 +82,9 @@ |
82 | 82 | return -EFAULT; |
83 | 83 | } else { |
84 | 84 | len = *count; |
85 | - rc = copy_from_user(buf, buffer, sizeof(buf)); | |
86 | - if (rc != 0) | |
87 | - return -EFAULT; | |
88 | - buf[sizeof(buf) - 1] = '\0'; | |
89 | - if (strict_strtoul(buf, 0, &val) != 0) | |
90 | - return -EINVAL; | |
85 | + rc = kstrtoul_from_user(buffer, len, 0, &val); | |
86 | + if (rc) | |
87 | + return rc; | |
91 | 88 | if (val != 0 && val != 1) |
92 | 89 | return -EINVAL; |
93 | 90 | callhome_enabled = val; |