All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fixes kernel panic with Null pointer in hid-appleir.c
@ 2014-06-20 16:25 Nicholas Krause
  2014-06-30 14:38 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Krause @ 2014-06-20 16:25 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, linux-kernel

In for loop of function appleir_input_configured we hit
a Null pointer after the for loop due to array_size not
being correct needs to be changed to input_dev->keycodemax.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/hid/hid-appleir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c
index 0e6a42d..ab0a702 100644
--- a/drivers/hid/hid-appleir.c
+++ b/drivers/hid/hid-appleir.c
@@ -272,7 +272,7 @@ static void appleir_input_configured(struct hid_device *hid,
 	input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
 
 	memcpy(appleir->keymap, appleir_key_table, sizeof(appleir->keymap));
-	for (i = 0; i < ARRAY_SIZE(appleir_key_table); i++)
+	for (i = 0; i < ARRAY_SIZE(input_dev->keycodemax); i++)
 		set_bit(appleir->keymap[i], input_dev->keybit);
 	clear_bit(KEY_RESERVED, input_dev->keybit);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fixes kernel panic with Null pointer in hid-appleir.c
  2014-06-20 16:25 [PATCH] Fixes kernel panic with Null pointer in hid-appleir.c Nicholas Krause
@ 2014-06-30 14:38 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2014-06-30 14:38 UTC (permalink / raw)
  To: Nicholas Krause; +Cc: linux-input, linux-kernel

On Fri, 20 Jun 2014, Nicholas Krause wrote:

> In for loop of function appleir_input_configured we hit
> a Null pointer after the for loop due to array_size not
> being correct needs to be changed to input_dev->keycodemax.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/hid/hid-appleir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c
> index 0e6a42d..ab0a702 100644
> --- a/drivers/hid/hid-appleir.c
> +++ b/drivers/hid/hid-appleir.c
> @@ -272,7 +272,7 @@ static void appleir_input_configured(struct hid_device *hid,
>  	input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
>  
>  	memcpy(appleir->keymap, appleir_key_table, sizeof(appleir->keymap));
> -	for (i = 0; i < ARRAY_SIZE(appleir_key_table); i++)
> +	for (i = 0; i < ARRAY_SIZE(input_dev->keycodemax); i++)

Ugh, how is this supposed to work? input_dev->keycodemax is int, not 
array. I think you actually want sizeof(appleir->keymap) there.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-30 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 16:25 [PATCH] Fixes kernel panic with Null pointer in hid-appleir.c Nicholas Krause
2014-06-30 14:38 ` Jiri Kosina

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.