Commit b38de31f authored by Peter Huewe's avatar Peter Huewe Committed by John W. Linville

net/mac80211/debugfs: Convert to kstrou8_from_user

This patch replaces the code for getting an number from a
userspace buffer by a simple call to kstrou8_from_user.
This makes it easier to read and less error prone.

Since the old buffer was only 10 bytes long and the value is masked by a
nibble-mask anyway, we don't need to use kstrtoul but rather kstrtou8.

Kernel Version: v3.0-rc2
Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e0a8c583
...@@ -195,20 +195,12 @@ static ssize_t uapsd_queues_write(struct file *file, ...@@ -195,20 +195,12 @@ static ssize_t uapsd_queues_write(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ieee80211_local *local = file->private_data; struct ieee80211_local *local = file->private_data;
unsigned long val; u8 val;
char buf[10];
size_t len;
int ret; int ret;
len = min(count, sizeof(buf) - 1); ret = kstrtou8_from_user(user_buf, count, 0, &val);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';
ret = strict_strtoul(buf, 0, &val);
if (ret) if (ret)
return -EINVAL; return ret;
if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
return -ERANGE; return -ERANGE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment