Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnd Bergmann" <arnd@kernel.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 08/10] [v6 net-next] p54spi: convert to devicetree
Date: Sat, 30 May 2026 00:45:17 +0000	[thread overview]
Message-ID: <20260530004518.009C71F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260520183815.2510387-9-arnd@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] SPI transfers are using stack-allocated buffers for `tx_buf` and `rx_buf`, violating the SPI subsystem's DMA requirements.
--

commit 8ba2b2da7516b867a52706d993b9ce2d49c99105
Author: Arnd Bergmann <arnd@arndb.de>

p54spi: convert to devicetree
    
The Prism54 SPI driver hardcodes GPIO numbers and expects users to
pass them as module parameters, apparently a relic from its life as a
staging driver. This works because there is only one user, the Nokia
N8x0 tablet.
    
Convert this to the gpio descriptor interface and DT based probing
to improve this and simplify the code at the same time.

> diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wireless/intersil/p54/p54spi.c
> index 9d66dcae54e02..d18be25450285 100644
> --- a/drivers/net/wireless/intersil/p54/p54spi.c
> +++ b/drivers/net/wireless/intersil/p54/p54spi.c
[ ... ]
> @@ -30,19 +31,6 @@
>  MODULE_FIRMWARE("3826.arm");
>  MODULE_FIRMWARE("3826.eeprom");
>  
> -/* gpios should be handled in board files and provided via platform data,
> - * but because it's currently impossible for p54spi to have a header file
> - * in include/linux, let's use module parameters for now
> - */
> -
> -static int p54spi_gpio_power = 97;
> -module_param(p54spi_gpio_power, int, 0444);
> -MODULE_PARM_DESC(p54spi_gpio_power, "gpio number for power line");
> -
> -static int p54spi_gpio_irq = 87;
> -module_param(p54spi_gpio_irq, int, 0444);
> -MODULE_PARM_DESC(p54spi_gpio_irq, "gpio number for irq line");
> -
>  static void p54spi_spi_read(struct p54s_priv *priv, u8 address,
>  			      void *buf, size_t len)
>  {

[Severity: High]
This isn't a bug introduced by this patch, but does this code use
stack-allocated buffers for SPI transfers?

It appears that p54spi_spi_read() and other similar functions pass stack
variables (e.g., addr in p54spi_spi_read(), rx_head in p54spi_rx(), and
val in p54spi_read32()) directly into spi_sync() as tx_buf and rx_buf.

If the underlying SPI controller uses DMA, the SPI core maps these buffers.
Using stack memory for DMA is unsafe because, with options like
CONFIG_VMAP_STACK enabled, the stack may not be physically contiguous.

Even without it, stack DMA leads to cache-line sharing and incoherency,
which can result in severe memory corruption or kernel panics.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260520183815.2510387-1-arnd@kernel.org?part=8

  reply	other threads:[~2026-05-30  0:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 18:38 [PATCH v2 00/10] gpiolib: fence off legacy interfaces Arnd Bergmann
2026-05-20 18:38 ` [PATCH 01/10] [v2] [net-next] net: dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2026-05-30  0:45   ` sashiko-bot
2026-05-20 18:38 ` [PATCH 02/10] [v3] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
2026-05-21  9:03   ` Bartosz Golaszewski
2026-05-22  4:55   ` Matti Vaittinen
2026-05-22  8:28     ` Arnd Bergmann
2026-05-22 12:45       ` Matti Vaittinen
2026-05-25  8:57   ` Linus Walleij
2026-05-29  5:37     ` Dmitry Torokhov
2026-05-30  0:45   ` sashiko-bot
2026-05-20 18:38 ` [PATCH 03/10] [v2] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
2026-05-20 18:38 ` [PATCH 04/10] [v2] sh: select legacy gpiolib interface Arnd Bergmann
2026-05-21  6:49   ` John Paul Adrian Glaubitz
2026-05-20 18:38 ` [PATCH 05/10] [v2] mips: select legacy gpiolib interfaces where used Arnd Bergmann
2026-05-30  0:45   ` sashiko-bot
2026-05-20 18:38 ` [PATCH 06/10] [v4] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2026-05-20 18:38 ` [PATCH 07/10] [v6 net-next] dt-bindings: net: add st,stlc4560/p54spi binding Arnd Bergmann
2026-05-21  9:04   ` Bartosz Golaszewski
2026-05-20 18:38 ` [PATCH 08/10] [v6 net-next] p54spi: convert to devicetree Arnd Bergmann
2026-05-30  0:45   ` sashiko-bot [this message]
2026-05-20 18:38 ` [PATCH 09/10] [v6 omap] ARM: dts: omap2: add stlc4560 spi-wireless node Arnd Bergmann
2026-05-20 21:39   ` Johannes Berg
2026-05-20 21:46   ` Andreas Kemnade
2026-05-20 18:38 ` [PATCH 10/10] gpiolib: turn off legacy interface by default Arnd Bergmann
2026-05-30  0:45   ` sashiko-bot

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=20260530004518.009C71F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arnd@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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