From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Mark Brown <broonie@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>
Cc: Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH] spi: bcm2835: add a sentinel at the end of the lookup array
Date: Wed, 4 Oct 2023 20:39:06 +0200 [thread overview]
Message-ID: <20231004183906.97845-1-brgl@bgdev.pl> (raw)
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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: 21f252cd29f0 ("spi: bcm2835: reduce the abuse of the GPIO API")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Closes: https://lore.kernel.org/lkml/29764d46-8d3d-9794-bbde-d7928a91cbb5@redhat.com/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/spi/spi-bcm2835.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index c9078fee3662..e709887eb2a9 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -1299,7 +1299,7 @@ static int bcm2835_spi_setup(struct spi_device *spi)
* More on the problem that it addresses:
* https://www.spinics.net/lists/linux-gpio/msg36218.html
*/
- lookup = kzalloc(struct_size(lookup, table, 1), GFP_KERNEL);
+ lookup = kzalloc(struct_size(lookup, table, 2), GFP_KERNEL);
if (!lookup) {
ret = -ENOMEM;
goto err_cleanup;
--
2.39.2
next reply other threads:[~2023-10-04 18:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 18:39 Bartosz Golaszewski [this message]
2023-10-05 9:10 ` [PATCH] spi: bcm2835: add a sentinel at the end of the lookup array Andy Shevchenko
2023-10-05 9:29 ` Bartosz Golaszewski
2023-10-10 12:04 ` Linus Walleij
2023-10-10 18:33 ` Mark Brown
2023-10-11 7:36 ` Bartosz Golaszewski
2023-10-11 11:45 ` Mark Brown
2023-10-11 11:52 ` Bartosz Golaszewski
2023-10-12 8:40 ` Bartosz Golaszewski
2023-10-12 10:12 ` Mark Brown
2023-10-12 10:48 ` Mark Brown
2023-10-11 14:50 ` Mark Brown
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=20231004183906.97845-1-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=hdegoede@redhat.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.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;
as well as URLs for NNTP newsgroup(s).