lkml.org 
[lkml]   [2011]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging/speakup: Use kstrtoul_from_user
Date
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>
---
drivers/staging/speakup/speakup_soft.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c
index a2c3dc4..42cdafe 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;
--
1.7.3.4


\
 
 \ /
  Last update: 2011-06-06 21:35    [W:0.025 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site