* [PATCH] HID: nintendo: Add missing array termination
@ 2022-07-12 22:17 Guenter Roeck
2022-07-12 22:35 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2022-07-12 22:17 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, linux-input, linux-kernel, Dmitry Torokhov,
Nergi Rahardi, Guenter Roeck, Daniel J . Ogorchock
joycon_dpad_inputs_jc[] is unterminated. This may result in odd warnings
such as
input: input_set_capability: invalid code 3077588140 for type 1
or in kernel crashes in nintendo_hid_probe(). Terminate the array to fix
the problem.
Fixes: 2af16c1f846bd ("HID: nintendo: add nintendo switch controller driver")
Cc: Daniel J. Ogorchock <djogorchock@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hid/hid-nintendo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index 2204de889739..4b1173957c17 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -1586,6 +1586,7 @@ static const unsigned int joycon_button_inputs_r[] = {
/* We report joy-con d-pad inputs as buttons and pro controller as a hat. */
static const unsigned int joycon_dpad_inputs_jc[] = {
BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT,
+ 0 /* 0 signals end of array */
};
static int joycon_input_create(struct joycon_ctlr *ctlr)
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: nintendo: Add missing array termination
2022-07-12 22:17 [PATCH] HID: nintendo: Add missing array termination Guenter Roeck
@ 2022-07-12 22:35 ` Dmitry Torokhov
2022-07-21 11:48 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2022-07-12 22:35 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel,
Nergi Rahardi, Daniel J . Ogorchock
On Tue, Jul 12, 2022 at 03:17:05PM -0700, Guenter Roeck wrote:
> joycon_dpad_inputs_jc[] is unterminated. This may result in odd warnings
> such as
>
> input: input_set_capability: invalid code 3077588140 for type 1
>
> or in kernel crashes in nintendo_hid_probe(). Terminate the array to fix
> the problem.
>
> Fixes: 2af16c1f846bd ("HID: nintendo: add nintendo switch controller driver")
> Cc: Daniel J. Ogorchock <djogorchock@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
I'd recommend tagging stable on this one.
> ---
> drivers/hid/hid-nintendo.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
> index 2204de889739..4b1173957c17 100644
> --- a/drivers/hid/hid-nintendo.c
> +++ b/drivers/hid/hid-nintendo.c
> @@ -1586,6 +1586,7 @@ static const unsigned int joycon_button_inputs_r[] = {
> /* We report joy-con d-pad inputs as buttons and pro controller as a hat. */
> static const unsigned int joycon_dpad_inputs_jc[] = {
> BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT,
> + 0 /* 0 signals end of array */
> };
>
> static int joycon_input_create(struct joycon_ctlr *ctlr)
> --
> 2.35.1
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: nintendo: Add missing array termination
2022-07-12 22:35 ` Dmitry Torokhov
@ 2022-07-21 11:48 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2022-07-21 11:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Guenter Roeck, Benjamin Tissoires, linux-input, linux-kernel,
Nergi Rahardi, Daniel J . Ogorchock
On Tue, 12 Jul 2022, Dmitry Torokhov wrote:
> On Tue, Jul 12, 2022 at 03:17:05PM -0700, Guenter Roeck wrote:
> > joycon_dpad_inputs_jc[] is unterminated. This may result in odd warnings
> > such as
> >
> > input: input_set_capability: invalid code 3077588140 for type 1
> >
> > or in kernel crashes in nintendo_hid_probe(). Terminate the array to fix
> > the problem.
> >
> > Fixes: 2af16c1f846bd ("HID: nintendo: add nintendo switch controller driver")
> > Cc: Daniel J. Ogorchock <djogorchock@gmail.com>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> I'd recommend tagging stable on this one.
I did so and applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-21 11:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 22:17 [PATCH] HID: nintendo: Add missing array termination Guenter Roeck
2022-07-12 22:35 ` Dmitry Torokhov
2022-07-21 11:48 ` 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.