aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-04-03 04:15:52 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-05-27 22:15:13 -0400
commit695b5bc3ecfc7da0a29360a6c2ee0849ffdb300a (patch)
tree5c6d8a4a44acccb6f9685b8d601d4b24357fb130 /net/ieee80211
parentff0e0ea2f5d36fa90fc2c57fd019102b0a0cfabf (diff)
[PATCH] ieee80211_module.c::store_debug_level() cleanup
* trivial __user annotations * store_debug_level() sanitized a bit Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Diffstat (limited to 'net/ieee80211')
-rw-r--r--net/ieee80211/ieee80211_module.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index e4ca0daaaeea..90bc50b97ea7 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -194,17 +194,23 @@ static int show_debug_level(char *page, char **start, off_t offset,
194 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); 194 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
195} 195}
196 196
197static int store_debug_level(struct file *file, const char *buffer, 197static int store_debug_level(struct file *file, const char __user *buffer,
198 unsigned long count, void *data) 198 unsigned long count, void *data)
199{ 199{
200 char buf[] = "0x00000000"; 200 char buf[] = "0x00000000";
201 unsigned long len = min(sizeof(buf) - 1, (u32)count);
202 char *p = (char *)buf; 201 char *p = (char *)buf;
203 unsigned long val; 202 unsigned long val;
204 203
205 if (copy_from_user(buf, buffer, len)) 204 if (count > sizeof(buf) - 1)
205 count = sizeof(buf) - 1;
206
207 if (copy_from_user(buf, buffer, count))
206 return count; 208 return count;
207 buf[len] = 0; 209 buf[count] = 0;
210 /*
211 * what a FPOS... What, sscanf(buf, "%i", &val) would be too
212 * scary?
213 */
208 if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { 214 if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
209 p++; 215 p++;
210 if (p[0] == 'x' || p[0] == 'X') 216 if (p[0] == 'x' || p[0] == 'X')
@@ -218,7 +224,7 @@ static int store_debug_level(struct file *file, const char *buffer,
218 else 224 else
219 ieee80211_debug_level = val; 225 ieee80211_debug_level = val;
220 226
221 return strnlen(buf, count); 227 return strlen(buf);
222} 228}
223 229
224static int __init ieee80211_init(void) 230static int __init ieee80211_init(void)