aboutsummaryrefslogtreecommitdiffstats
path: root/net/rfkill/rfkill.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-08-26 10:57:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:10 -0400
commit849e0576a76bc421aacd782f97948856f487726c (patch)
tree284a8fec1a1b9e25f4c1e6bbeb8c739290c90b70 /net/rfkill/rfkill.c
parent5701ed843ea87bf8a1d2c4dee5edcb463558db4a (diff)
rfkill: use strict_strtoul (v2)
Switch sysfs parsing to something that actually works properly. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/rfkill/rfkill.c')
-rw-r--r--net/rfkill/rfkill.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 47e0b2d232e3..173d039d9909 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -402,12 +402,16 @@ static ssize_t rfkill_state_store(struct device *dev,
402 const char *buf, size_t count) 402 const char *buf, size_t count)
403{ 403{
404 struct rfkill *rfkill = to_rfkill(dev); 404 struct rfkill *rfkill = to_rfkill(dev);
405 unsigned int state = simple_strtoul(buf, NULL, 0); 405 unsigned long state;
406 int error; 406 int error;
407 407
408 if (!capable(CAP_NET_ADMIN)) 408 if (!capable(CAP_NET_ADMIN))
409 return -EPERM; 409 return -EPERM;
410 410
411 error = strict_strtoul(buf, 0, &state);
412 if (error)
413 return error;
414
411 /* RFKILL_STATE_HARD_BLOCKED is illegal here... */ 415 /* RFKILL_STATE_HARD_BLOCKED is illegal here... */
412 if (state != RFKILL_STATE_UNBLOCKED && 416 if (state != RFKILL_STATE_UNBLOCKED &&
413 state != RFKILL_STATE_SOFT_BLOCKED) 417 state != RFKILL_STATE_SOFT_BLOCKED)
@@ -435,7 +439,8 @@ static ssize_t rfkill_claim_store(struct device *dev,
435 const char *buf, size_t count) 439 const char *buf, size_t count)
436{ 440{
437 struct rfkill *rfkill = to_rfkill(dev); 441 struct rfkill *rfkill = to_rfkill(dev);
438 bool claim = !!simple_strtoul(buf, NULL, 0); 442 unsigned long claim_tmp;
443 bool claim;
439 int error; 444 int error;
440 445
441 if (!capable(CAP_NET_ADMIN)) 446 if (!capable(CAP_NET_ADMIN))
@@ -444,6 +449,11 @@ static ssize_t rfkill_claim_store(struct device *dev,
444 if (rfkill->user_claim_unsupported) 449 if (rfkill->user_claim_unsupported)
445 return -EOPNOTSUPP; 450 return -EOPNOTSUPP;
446 451
452 error = strict_strtoul(buf, 0, &claim_tmp);
453 if (error)
454 return error;
455 claim = !!claim_tmp;
456
447 /* 457 /*
448 * Take the global lock to make sure the kernel is not in 458 * Take the global lock to make sure the kernel is not in
449 * the middle of rfkill_switch_all 459 * the middle of rfkill_switch_all