From: Ivo van Doorn <ivdoorn@gmail.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: John Linville <linville@tuxdriver.com>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] rfkill: use strict_strtoul
Date: Sat, 2 Aug 2008 20:25:19 +0200 [thread overview]
Message-ID: <200808022025.19323.IvDoorn@gmail.com> (raw)
In-Reply-To: <1217699786-20672-3-git-send-email-hmh@hmh.eng.br>
On Saturday 02 August 2008, Henrique de Moraes Holschuh wrote:
> Switch sysfs parsing to something that actually works properly.
>
> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Cc: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> net/rfkill/rfkill.c | 16 ++++++++++++----
> 1 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
> index 35a9994..2ec6312 100644
> --- a/net/rfkill/rfkill.c
> +++ b/net/rfkill/rfkill.c
> @@ -352,12 +352,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)
> @@ -385,7 +389,7 @@ 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;
> int error;
>
> if (!capable(CAP_NET_ADMIN))
> @@ -394,6 +398,10 @@ static ssize_t rfkill_claim_store(struct device *dev,
> if (rfkill->user_claim_unsupported)
> return -EOPNOTSUPP;
>
> + error = strict_strtoul(buf, 0, &claim);
> + if (error)
> + return error;
> +
> /*
> * Take the global lock to make sure the kernel is not in
> * the middle of rfkill_switch_all
> @@ -402,7 +410,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
> if (error)
> return error;
>
> - if (rfkill->user_claim != claim) {
> + if (!!rfkill->user_claim != !!claim) {
> if (!claim) {
> mutex_lock(&rfkill->mutex);
> rfkill_toggle_radio(rfkill,
> @@ -410,7 +418,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
> 0);
> mutex_unlock(&rfkill->mutex);
> }
> - rfkill->user_claim = claim;
> + rfkill->user_claim = !!claim;
> }
>
> mutex_unlock(&rfkill_mutex);
next prev parent reply other threads:[~2008-08-02 18:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-02 17:56 [GIT PATCH] rfkill fixes, set 3 Henrique de Moraes Holschuh
2008-08-02 17:56 ` [PATCH 1/2] rfkill: protect suspended rfkill controllers Henrique de Moraes Holschuh
2008-08-02 18:25 ` Ivo van Doorn
2008-08-02 17:56 ` [PATCH 2/2] rfkill: use strict_strtoul Henrique de Moraes Holschuh
2008-08-02 18:25 ` Ivo van Doorn [this message]
2008-08-17 18:16 ` John W. Linville
2008-08-17 19:31 ` Michael Buesch
2008-08-19 21:53 ` Henrique de Moraes Holschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808022025.19323.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=hmh@hmh.eng.br \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).