diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2011-06-07 16:36:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-29 15:25:28 -0400 |
commit | b38de31ffa870323c4f6957904303477c88fe905 (patch) | |
tree | 7f409292ea95bccb626c046572c3e2fd63c91107 /net/mac80211/debugfs.c | |
parent | e0a8c583c39580a97919c026598eedbf014cd8a5 (diff) |
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: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/debugfs.c')
-rw-r--r-- | net/mac80211/debugfs.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 186e02f7cc32..267ed45ef6a2 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -195,20 +195,12 @@ static ssize_t uapsd_queues_write(struct file *file, | |||
195 | size_t count, loff_t *ppos) | 195 | size_t count, loff_t *ppos) |
196 | { | 196 | { |
197 | struct ieee80211_local *local = file->private_data; | 197 | struct ieee80211_local *local = file->private_data; |
198 | unsigned long val; | 198 | u8 val; |
199 | char buf[10]; | ||
200 | size_t len; | ||
201 | int ret; | 199 | int ret; |
202 | 200 | ||
203 | len = min(count, sizeof(buf) - 1); | 201 | ret = kstrtou8_from_user(user_buf, count, 0, &val); |
204 | if (copy_from_user(buf, user_buf, len)) | ||
205 | return -EFAULT; | ||
206 | buf[len] = '\0'; | ||
207 | |||
208 | ret = strict_strtoul(buf, 0, &val); | ||
209 | |||
210 | if (ret) | 202 | if (ret) |
211 | return -EINVAL; | 203 | return ret; |
212 | 204 | ||
213 | if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) | 205 | if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) |
214 | return -ERANGE; | 206 | return -ERANGE; |