All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guanglei Zhu" <zhugl3@xiaopeng.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2] Input: lpc32xx-keys - reject matrices bigger than the hardware has
Date: Thu, 05 Nov 2026 15:53:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-199362@kernel.org> (raw)
In-Reply-To: <20261104030709.791761-1-zhugl3@xiaopeng.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Input: lpc32xx-keys: undeclared LPC32XX_MAX_MATRIX_SIZE in lpc32xx_parse_dt()
--

commit ae2a42c5ed13c05919e7d77f5f4978ad957e69a7
Author: Guanglei Zhu <zhugl3@xiaopeng.com>

Input: lpc32xx-keys - reject matrices bigger than the hardware has

This commit adds an upper-bound check in lpc32xx_parse_dt() to reject device
tree keypad matrices larger than LPC32XX_MAX_MATRIX_SIZE, preventing
out-of-bounds accesses to the lastkeystates array.

> diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c
> index 285d5c32fe70f..b7cd968311cd2 100644
> --- a/drivers/input/keyboard/lpc32xx-keys.c
> +++ b/drivers/input/keyboard/lpc32xx-keys.c
> @@ -65,7 +65,7 @@ struct lpc32xx_kscan_drv {
>  	unsigned int row_shift;
>  	unsigned short *keymap;	/* Pointer to key map for the scan matrix */
>  
> -	u8 lastkeystates[8];
> +	u8 lastkeystates[LPC32XX_MAX_MATRIX_SIZE];
>  };
>  
>  static void lpc32xx_mod_states(struct lpc32xx_kscan_drv *kscandat, int col)
> @@ -141,6 +141,12 @@ static int lpc32xx_parse_dt(struct device *dev,
>  		dev_err(dev, "rows and columns must be equal!\n");
>  		return -EINVAL;
>  	}
> +	if (rows > LPC32XX_MAX_MATRIX_SIZE) {
> +		dev_err(dev, "rows and columns must be at most %d!\n",
> +			LPC32XX_MAX_MATRIX_SIZE);
> +		return -EINVAL;
> +	}

[Severity: Low]
Does this break the build when CONFIG_KEYBOARD_LPC32XX is enabled? Both
struct lpc32xx_kscan_drv and lpc32xx_parse_dt() in
drivers/input/keyboard/lpc32xx-keys.c reference LPC32XX_MAX_MATRIX_SIZE,
which is not defined anywhere in the file or included headers. Was a
#define LPC32XX_MAX_MATRIX_SIZE 8 macro definition omitted from the patch?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261104030709.791761-1-zhugl3@xiaopeng.com?part=1

  parent reply	other threads:[~2026-11-05 15:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  8:41 [PATCH] Input: joydev - avoid an undefined shift in the legacy 0x read Guanglei Zhu
2026-11-03  8:41 ` [PATCH] Input: joydev - avoid signed overflow in the broken-axis correction Guanglei Zhu
2026-11-03  8:48   ` sashiko-bot
2026-11-03  8:55   ` [PATCH v2] " Guanglei Zhu
2026-11-04  3:38     ` Dmitry Torokhov
2026-11-04  5:50       ` [PATCH v3] " Guanglei Zhu
2026-11-04 23:45         ` Dmitry Torokhov
2026-11-04  6:02       ` Guanglei Zhu
2026-11-03  8:41 ` [PATCH] Input: adi - bound the two-stream packet merge Guanglei Zhu
2026-11-03  8:55   ` sashiko-bot
2026-11-03 11:17   ` [PATCH v2] " Guanglei Zhu
2026-11-04 22:17     ` Dmitry Torokhov
2026-11-03  8:41 ` [PATCH] Input: db9 - enlarge the Saturn multitap packet buffer Guanglei Zhu
2026-11-04 23:46   ` Dmitry Torokhov
2026-11-03  8:41 ` [PATCH] Input: lpc32xx-keys - reject matrices bigger than the hardware has Guanglei Zhu
2026-11-03 18:54   ` Dmitry Torokhov
2026-11-04  3:07     ` [PATCH v2] " Guanglei Zhu
2026-11-04  6:25       ` Dmitry Torokhov
2026-11-05 15:53       ` sashiko-bot [this message]
2026-11-03  8:41 ` [PATCH] Input: mt6779-keypad - check the reported row and column Guanglei Zhu
2026-11-04 23:52   ` Dmitry Torokhov
2026-11-03  8:41 ` [PATCH] Input: tegra-kbc - check the pin numbers from the device tree Guanglei Zhu
2026-11-04 17:08   ` Dmitry Torokhov
2026-11-05  2:13   ` [PATCH v2] " Guanglei Zhu
2026-11-03  8:41 ` [PATCH] Input: cyapa_gen3 - clamp the reported finger count to the array Guanglei Zhu
2026-11-04 20:09   ` Dmitry Torokhov
2026-11-03 18:45 ` [PATCH] Input: joydev - avoid an undefined shift in the legacy 0x read Dmitry Torokhov
2026-11-04  3:07   ` [PATCH v2] " Guanglei Zhu

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=sashiko-outbox-199362@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhugl3@xiaopeng.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 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.