From: Randy Dunlap <rdunlap@infradead.org>
To: Arjun Sreedharan <arjun024@gmail.com>, rjw@rjwysocki.net
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, joe@perches.com
Subject: Re: [PATCH] Replace faulty is_hex_digit() by isxdigit()
Date: Thu, 31 Jul 2014 09:31:37 -0700 [thread overview]
Message-ID: <53DA6F69.5050500@infradead.org> (raw)
In-Reply-To: <1406797489-4296-1-git-send-email-arjun024@gmail.com>
On 07/31/14 02:04, Arjun Sreedharan wrote:
> 0 is ascii for NULL. Hex digit matching should be from '0'.
> Faulty version returns true for #,$,%,& etc.
>
> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> drivers/acpi/acpi_pnp.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
> index 4ddb0dc..996fa19 100644
> --- a/drivers/acpi/acpi_pnp.c
> +++ b/drivers/acpi/acpi_pnp.c
> @@ -12,6 +12,7 @@
>
> #include <linux/acpi.h>
> #include <linux/module.h>
> +#include <linux/ctype.h>
>
> static const struct acpi_device_id acpi_pnp_device_ids[] = {
> /* soc_button_array */
> @@ -320,11 +321,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = {
> {""},
> };
>
> -static bool is_hex_digit(char c)
> -{
> - return (c >= 0 && c <= '9') || (c >= 'A' && c <= 'F');
> -}
> -
> static bool matching_id(char *idstr, char *list_id)
> {
> int i;
> @@ -335,7 +331,7 @@ static bool matching_id(char *idstr, char *list_id)
> for (i = 3; i < 7; i++) {
> char c = toupper(idstr[i]);
>
> - if (!is_hex_digit(c)
> + if (!isxdigit(c)
> || (list_id[i] != 'X' && c != toupper(list_id[i])))
> return false;
> }
>
--
~Randy
next prev parent reply other threads:[~2014-07-31 16:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-30 19:52 [PATCH] ACPI: fix test for hex digit Arjun Sreedharan
2014-07-30 20:00 ` Joe Perches
2014-07-31 0:05 ` [PATCH] Replace faulty is_hex_digit() by isxdigit() Arjun Sreedharan
2014-07-31 0:10 ` Randy Dunlap
2014-07-31 9:04 ` Arjun Sreedharan
2014-07-31 16:31 ` Randy Dunlap [this message]
2014-07-31 22:31 ` Rafael J. Wysocki
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=53DA6F69.5050500@infradead.org \
--to=rdunlap@infradead.org \
--cc=arjun024@gmail.com \
--cc=joe@perches.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.