Skip to content

Commit

Permalink
[S390] qdio: Use kstrtoul_from_user
Browse files Browse the repository at this point in the history
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>
Acked-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
  • Loading branch information
Peter Huewe authored and Heiko Carstens committed Aug 3, 2011
1 parent d5f4d11 commit af6df87
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions drivers/s390/cio/qdio_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,13 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
struct qdio_irq *irq_ptr = seq->private;
struct qdio_q *q;
unsigned long val;
char buf[8];
int ret, i;

if (!irq_ptr)
return 0;
if (count >= sizeof(buf))
return -EINVAL;
if (copy_from_user(&buf, ubuf, count))
return -EFAULT;
buf[count] = 0;

ret = strict_strtoul(buf, 10, &val);
if (ret < 0)

ret = kstrtoul_from_user(ubuf, count, 10, &val);
if (ret)
return ret;

switch (val) {
Expand Down

0 comments on commit af6df87

Please sign in to comment.