diff options
author | Peter Hüwe <PeterHuewe@gmx.de> | 2012-04-14 09:42:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-15 03:23:31 -0400 |
commit | 8831a3f2c9ee7d952e6d7a018d11c0c9c5b56749 (patch) | |
tree | 8e3f7c54f9fc5aa95be9be0fdd95ade6bff8ca85 /drivers/isdn | |
parent | cf22f9a2b83e72082c43ef5c942d5daf9301da8e (diff) |
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 <peterhuewe@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/hysdn/hysdn_proclog.c | 10 |
1 files changed, 1 insertions, 9 deletions
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 | |||
156 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t *off) | 156 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t *off) |
157 | { | 157 | { |
158 | int rc; | 158 | int rc; |
159 | unsigned char valbuf[128]; | ||
160 | hysdn_card *card = file->private_data; | 159 | hysdn_card *card = file->private_data; |
161 | 160 | ||
162 | if (count > (sizeof(valbuf) - 1)) | 161 | rc = kstrtoul_from_user(buf, count, 0, &card->debug_flags); |
163 | count = sizeof(valbuf) - 1; /* limit length */ | ||
164 | if (copy_from_user(valbuf, buf, count)) | ||
165 | return (-EFAULT); /* copy failed */ | ||
166 | |||
167 | valbuf[count] = 0; /* terminating 0 */ | ||
168 | |||
169 | rc = kstrtoul(valbuf, 0, &card->debug_flags); | ||
170 | if (rc < 0) | 162 | if (rc < 0) |
171 | return rc; | 163 | return rc; |
172 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); | 164 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); |