* [PATCH] ACPI: fix test for hex digit.
@ 2014-07-30 19:52 Arjun Sreedharan
2014-07-30 20:00 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: Arjun Sreedharan @ 2014-07-30 19:52 UTC (permalink / raw)
To: rjw; +Cc: lenb, linux-acpi, linux-kernel
decimal 0 is ascii for NULL. Hex digit matching should be from '0'
(decimal 30 of ascii) to '9' and 'A' to 'F'.
Unfixed version returns true for #,$,%,& etc.
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
drivers/acpi/acpi_pnp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
index 4ddb0dc..a4945a5 100644
--- a/drivers/acpi/acpi_pnp.c
+++ b/drivers/acpi/acpi_pnp.c
@@ -322,7 +322,7 @@ 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');
+ return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F');
}
static bool matching_id(char *idstr, char *list_id)
--
1.8.1.msysgit.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI: fix test for hex digit.
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
0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2014-07-30 20:00 UTC (permalink / raw)
To: Arjun Sreedharan; +Cc: rjw, lenb, linux-acpi, linux-kernel
On Thu, 2014-07-31 at 01:22 +0530, Arjun Sreedharan wrote:
> decimal 0 is ascii for NULL. Hex digit matching should be from '0'
> (decimal 30 of ascii) to '9' and 'A' to 'F'.
> Unfixed version returns true for #,$,%,& etc.
[]
> diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
[]
> @@ -322,7 +322,7 @@ 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');
> + return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F');
> }
Maybe delete this and do s/is_hex_digit/isxdigit/ ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Replace faulty is_hex_digit() by isxdigit()
2014-07-30 20:00 ` Joe Perches
@ 2014-07-31 0:05 ` Arjun Sreedharan
2014-07-31 0:10 ` Randy Dunlap
0 siblings, 1 reply; 7+ messages in thread
From: Arjun Sreedharan @ 2014-07-31 0:05 UTC (permalink / raw)
To: rjw; +Cc: lenb, linux-acpi, linux-kernel, joe
0 is ascii for NULL. Hex digit matching should be from '0'.
Unfixed version returns true for #,$,%,& etc.
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
drivers/acpi/acpi_pnp.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
index 4ddb0dc..6d5922d 100644
--- a/drivers/acpi/acpi_pnp.c
+++ b/drivers/acpi/acpi_pnp.c
@@ -320,11 +320,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 +330,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;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Replace faulty is_hex_digit() by isxdigit()
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
0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2014-07-31 0:10 UTC (permalink / raw)
To: Arjun Sreedharan, rjw; +Cc: lenb, linux-acpi, linux-kernel, joe
On 07/30/14 17:05, Arjun Sreedharan wrote:
> 0 is ascii for NULL. Hex digit matching should be from '0'.
> Unfixed version returns true for #,$,%,& etc.
>
> Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
> ---
> drivers/acpi/acpi_pnp.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
> index 4ddb0dc..6d5922d 100644
> --- a/drivers/acpi/acpi_pnp.c
> +++ b/drivers/acpi/acpi_pnp.c
#include <linux/ctype.h>
Thanks.
> @@ -320,11 +320,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 +330,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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Replace faulty is_hex_digit() by isxdigit()
2014-07-31 0:10 ` Randy Dunlap
@ 2014-07-31 9:04 ` Arjun Sreedharan
2014-07-31 16:31 ` Randy Dunlap
0 siblings, 1 reply; 7+ messages in thread
From: Arjun Sreedharan @ 2014-07-31 9:04 UTC (permalink / raw)
To: rjw; +Cc: lenb, linux-acpi, linux-kernel, joe, rdunlap
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>
---
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;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Replace faulty is_hex_digit() by isxdigit()
2014-07-31 9:04 ` Arjun Sreedharan
@ 2014-07-31 16:31 ` Randy Dunlap
2014-07-31 22:31 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2014-07-31 16:31 UTC (permalink / raw)
To: Arjun Sreedharan, rjw; +Cc: lenb, linux-acpi, linux-kernel, joe
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Replace faulty is_hex_digit() by isxdigit()
2014-07-31 16:31 ` Randy Dunlap
@ 2014-07-31 22:31 ` Rafael J. Wysocki
0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2014-07-31 22:31 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Arjun Sreedharan, lenb, linux-acpi, linux-kernel, joe
On Thursday, July 31, 2014 09:31:37 AM Randy Dunlap wrote:
> 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>
Applied, thanks!
> 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;
> > }
> >
>
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-31 22:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-07-31 22:31 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox