From: Peter Huewe Date: Mon, 6 Jun 2011 19:32:32 +0000 (+0200) Subject: staging: speakup: Use kstrtoul_from_user X-Git-Tag: MMI-PSA29.97-13-9~18845^2~494 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6263ba551985ad7201d0e7f36672c7a0f57f61f4;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: speakup: 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. Kernel Version: staging of 20110606 Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index a2c3dc4098b9..42cdafeea35e 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -273,15 +273,8 @@ static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count, { unsigned long supplied_index = 0; int converted; - char indbuf[5]; - if (count >= sizeof(indbuf)) - return -EINVAL; - if (copy_from_user(indbuf, buf, count)) - return -EFAULT; - indbuf[count] = '\0'; - - converted = strict_strtoul(indbuf, 0, &supplied_index); + converted = kstrtoul_from_user(buf, count, 0, &supplied_index); if (converted < 0) return converted;