[PATCH] ieee80211 Switched to sscanf in store_debug_level
Switched to sscanf as per friendly comment in store_debug_level. Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
committed by
Jeff Garzik
parent
18294d8727
commit
262d8e4677
@@ -195,34 +195,20 @@ static int show_debug_level(char *page, char **start, off_t offset,
|
|||||||
static int store_debug_level(struct file *file, const char __user * buffer,
|
static int store_debug_level(struct file *file, const char __user * buffer,
|
||||||
unsigned long count, void *data)
|
unsigned long count, void *data)
|
||||||
{
|
{
|
||||||
char buf[] = "0x00000000";
|
char buf[] = "0x00000000\n";
|
||||||
char *p = (char *)buf;
|
unsigned long len = min((unsigned long)sizeof(buf) - 1, count);
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
|
||||||
if (count > sizeof(buf) - 1)
|
if (copy_from_user(buf, buffer, len))
|
||||||
count = sizeof(buf) - 1;
|
|
||||||
|
|
||||||
if (copy_from_user(buf, buffer, count))
|
|
||||||
return count;
|
return count;
|
||||||
buf[count] = 0;
|
buf[len] = 0;
|
||||||
/*
|
if (sscanf(buf, "%li", &val) != 1)
|
||||||
* what a FPOS... What, sscanf(buf, "%i", &val) would be too
|
|
||||||
* scary?
|
|
||||||
*/
|
|
||||||
if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
|
|
||||||
p++;
|
|
||||||
if (p[0] == 'x' || p[0] == 'X')
|
|
||||||
p++;
|
|
||||||
val = simple_strtoul(p, &p, 16);
|
|
||||||
} else
|
|
||||||
val = simple_strtoul(p, &p, 10);
|
|
||||||
if (p == buf)
|
|
||||||
printk(KERN_INFO DRV_NAME
|
printk(KERN_INFO DRV_NAME
|
||||||
": %s is not in hex or decimal form.\n", buf);
|
": %s is not in hex or decimal form.\n", buf);
|
||||||
else
|
else
|
||||||
ieee80211_debug_level = val;
|
ieee80211_debug_level = val;
|
||||||
|
|
||||||
return strlen(buf);
|
return strnlen(buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init ieee80211_init(void)
|
static int __init ieee80211_init(void)
|
||||||
|
Reference in New Issue
Block a user