From: Peter Hüwe Date: Sat, 14 Apr 2012 13:42:59 +0000 (+0000) Subject: isdn/hysdn: Convert to kstrtoul_from_user X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8831a3f2c9ee7d952e6d7a018d11c0c9c5b56749;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git isdn/hysdn: Convert to kstrtoul_from_user This patch replaces the code for getting an number 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 Signed-off-by: David S. Miller --- diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index ba91333e3e41..88e4f0ee073c 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c @@ -156,17 +156,9 @@ static ssize_t hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t *off) { int rc; - unsigned char valbuf[128]; hysdn_card *card = file->private_data; - if (count > (sizeof(valbuf) - 1)) - count = sizeof(valbuf) - 1; /* limit length */ - if (copy_from_user(valbuf, buf, count)) - return (-EFAULT); /* copy failed */ - - valbuf[count] = 0; /* terminating 0 */ - - rc = kstrtoul(valbuf, 0, &card->debug_flags); + rc = kstrtoul_from_user(buf, count, 0, &card->debug_flags); if (rc < 0) return rc; hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);