public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nergi Rahardi <nergi@google.com>,
	"Daniel J . Ogorchock" <djogorchock@gmail.com>
Subject: Re: [PATCH] HID: nintendo: Add missing array termination
Date: Tue, 12 Jul 2022 15:35:00 -0700	[thread overview]
Message-ID: <Ys33FIuNEsyZw8EF@google.com> (raw)
In-Reply-To: <20220712221705.1847793-1-linux@roeck-us.net>

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

  reply	other threads:[~2022-07-12 22:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 22:17 [PATCH] HID: nintendo: Add missing array termination Guenter Roeck
2022-07-12 22:35 ` Dmitry Torokhov [this message]
2022-07-21 11:48   ` Jiri Kosina

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=Ys33FIuNEsyZw8EF@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=djogorchock@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nergi@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox