lkml.org 
[lkml]   [2014]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Replace faulty is_hex_digit() by isxdigit()
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


\
 
 \ /
  Last update: 2014-07-31 07:01    [W:0.316 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site