aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2011-06-06 15:32:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-28 17:35:41 -0400
commit6263ba551985ad7201d0e7f36672c7a0f57f61f4 (patch)
treeee4f9f8c081f830aa8a730ae33a33ca43dc13fb5 /drivers/staging/speakup
parent919ed52f33a9250b5707804b1a84b4b7cbfe2333 (diff)
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 <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r--drivers/staging/speakup/speakup_soft.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c
index a2c3dc4098b..42cdafeea35 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,
273{ 273{
274 unsigned long supplied_index = 0; 274 unsigned long supplied_index = 0;
275 int converted; 275 int converted;
276 char indbuf[5];
277 if (count >= sizeof(indbuf))
278 return -EINVAL;
279 276
280 if (copy_from_user(indbuf, buf, count)) 277 converted = kstrtoul_from_user(buf, count, 0, &supplied_index);
281 return -EFAULT;
282 indbuf[count] = '\0';
283
284 converted = strict_strtoul(indbuf, 0, &supplied_index);
285 278
286 if (converted < 0) 279 if (converted < 0)
287 return converted; 280 return converted;