[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241117033445.work.274-kees@kernel.org>
Date: Sat, 16 Nov 2024 19:34:50 -0800
From: Kees Cook <kees@...nel.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Kees Cook <kees@...nel.org>,
Marek Vasut <marex@...x.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
Luca Ellero <l.ellero@...m.it>,
linux-input@...r.kernel.org,
Alexander Stein <alexander.stein@...tq-group.com>,
Al Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: [PATCH] Input: ads7846 - Expand xfer array to match usage
Commit 781a07da9bb9 ("Input: ads7846 - add dummy command register
clearing cycle") added commands to struct ser_req::xfer without
expanding it to hold them. Expand the array to the correct size.
../drivers/input/touchscreen/ads7846.c: In function 'ads7846_read12_ser':
../drivers/input/touchscreen/ads7846.c:416:18: error: array subscript 7 is above array bounds of 'struct spi_transfer[6]' [-Werror=array-bounds=]
416 | req->xfer[7].rx_buf = &req->scratch;
| ~~~~~~~~~^~~
../drivers/input/touchscreen/ads7846.c:334:33: note: while referencing 'xfer'
334 | struct spi_transfer xfer[6];
| ^~~~
Fixes: 781a07da9bb9 ("Input: ads7846 - add dummy command register clearing cycle")
Signed-off-by: Kees Cook <kees@...nel.org>
---
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Marek Vasut <marex@...x.de>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Luca Ellero <l.ellero@...m.it>
Cc: linux-input@...r.kernel.org
---
drivers/input/touchscreen/ads7846.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 75e5b2e4368d..066dc04003fa 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -331,7 +331,7 @@ struct ser_req {
u8 ref_off;
u16 scratch;
struct spi_message msg;
- struct spi_transfer xfer[6];
+ struct spi_transfer xfer[8];
/*
* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
--
2.34.1
Powered by blists - more mailing lists