diff options
author | Nathan Chancellor <nathan@kernel.org> | 2024-11-11 08:09:55 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-11-14 18:04:52 -0800 |
commit | 470a271627e8c4e2b5357fd0f5759cf6e33cc145 (patch) | |
tree | 665833fb124262a0d5408c144338579e5946191a /drivers/input | |
parent | a5f040cfcfdd8cd10591d50fb6280dffe07c7a8e (diff) | |
download | linux-stable-470a271627e8c4e2b5357fd0f5759cf6e33cc145.tar.gz linux-stable-470a271627e8c4e2b5357fd0f5759cf6e33cc145.tar.bz2 linux-stable-470a271627e8c4e2b5357fd0f5759cf6e33cc145.zip |
Input: ads7846 - increase xfer array size in 'struct ser_req'
Clang warns (or errors with CONFIG_WERROR=y, trimmed for brevity):
drivers/input/touchscreen/ads7846.c:412:2: error: array index 6 is past the end of the array (that has type 'struct spi_transfer[6]') [-Werror,-Warray-bounds]
412 | req->xfer[6].tx_buf = &req->scratch;
| ^ ~
...
drivers/input/touchscreen/ads7846.c:416:2: error: array index 7 is past the end of the array (that has type 'struct spi_transfer[6]') [-Werror,-Warray-bounds]
416 | req->xfer[7].rx_buf = &req->scratch;
| ^ ~
drivers/input/touchscreen/ads7846.c:334:2: note: array 'xfer' declared here
334 | struct spi_transfer xfer[6];
| ^
Increase the size of xfer in 'struct ser_req' to ensure that there is
enough space for all necessary members and there are no out of bounds
accesses, clearing up the warning.
Fixes: 781a07da9bb9 ("Input: ads7846 - add dummy command register clearing cycle")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20241111-input-ads7846-increase-xfer-array-size-v1-1-06cd92e9f20f@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index f7bc0a3e56d8..7b3711a3597c 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. |