Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Peter Huewe and committed by
Heiko Carstens
d5f4d113 ada5ed54

+3 -6
+3 -6
drivers/s390/char/sclp_async.c
··· 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;