Skip to content

Commit 9aaa25d

Browse files
Bartosz Golaszewskibroonie
authored andcommitted
spi: bcm2835: add a sentinel at the end of the lookup array
GPIOLIB expects the array of lookup entries to be terminated with an empty member. We need to increase the size of the variable length array in the lookup table by 1. Fixes: 21f252c ("spi: bcm2835: reduce the abuse of the GPIO API") Reported-by: Hans de Goede <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8a6b446 commit 9aaa25d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-bcm2835.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12991299
* More on the problem that it addresses:
13001300
* https://www.spinics.net/lists/linux-gpio/msg36218.html
13011301
*/
1302-
lookup = kzalloc(struct_size(lookup, table, 1), GFP_KERNEL);
1302+
lookup = kzalloc(struct_size(lookup, table, 2), GFP_KERNEL);
13031303
if (!lookup) {
13041304
ret = -ENOMEM;
13051305
goto err_cleanup;

0 commit comments

Comments
 (0)