diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-08-26 11:57:57 -0300 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:24:10 -0400 |
commit | 849e0576a76bc421aacd782f97948856f487726c (patch) | |
tree | 284a8fec1a1b9e25f4c1e6bbeb8c739290c90b70 /net/rfkill | |
parent | 5701ed843ea87bf8a1d2c4dee5edcb463558db4a (diff) | |
download | kernel_samsung_smdk4412-849e0576a76bc421aacd782f97948856f487726c.tar.gz kernel_samsung_smdk4412-849e0576a76bc421aacd782f97948856f487726c.tar.bz2 kernel_samsung_smdk4412-849e0576a76bc421aacd782f97948856f487726c.zip |
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')
-rw-r--r-- | net/rfkill/rfkill.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 47e0b2d232e..173d039d990 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c @@ -402,12 +402,16 @@ static ssize_t rfkill_state_store(struct device *dev, const char *buf, size_t count) { struct rfkill *rfkill = to_rfkill(dev); - unsigned int state = simple_strtoul(buf, NULL, 0); + unsigned long state; int error; if (!capable(CAP_NET_ADMIN)) return -EPERM; + error = strict_strtoul(buf, 0, &state); + if (error) + return error; + /* RFKILL_STATE_HARD_BLOCKED is illegal here... */ if (state != RFKILL_STATE_UNBLOCKED && state != RFKILL_STATE_SOFT_BLOCKED) @@ -435,7 +439,8 @@ static ssize_t rfkill_claim_store(struct device *dev, const char *buf, size_t count) { struct rfkill *rfkill = to_rfkill(dev); - bool claim = !!simple_strtoul(buf, NULL, 0); + unsigned long claim_tmp; + bool claim; int error; if (!capable(CAP_NET_ADMIN)) @@ -444,6 +449,11 @@ static ssize_t rfkill_claim_store(struct device *dev, if (rfkill->user_claim_unsupported) return -EOPNOTSUPP; + error = strict_strtoul(buf, 0, &claim_tmp); + if (error) + return error; + claim = !!claim_tmp; + /* * Take the global lock to make sure the kernel is not in * the middle of rfkill_switch_all |