[PATCH 12/13] gpib: gpio: replace linux/gpio.h inclusion
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Jun 30 06:28:35 PDT 2026
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] The patch introduces redundant duplicate `#include <linux/gpio/consumer.h>` statements in multiple files.
Pre-existing issues:
- [High] Missing bounds check on `priv->count` in `bb_DAV_interrupt()` can lead to a buffer overflow.
--
commit 198cff3fadd8f7ab5db98a0ff2a666f4ac7f1bf0
Author: Arnd Bergmann <arnd at arndb.de>
gpib: gpio: replace linux/gpio.h inclusion
linux/gpio.h is going away, so use linux/gpio/consumer.h instead.
> diff --git a/drivers/gpib/gpio/gpib_bitbang.c b/drivers/gpib/gpio/gpib_bitbang.c
> index 0e227980b493a..2e8d895db06a5 100644
> --- a/drivers/gpib/gpio/gpib_bitbang.c
> +++ b/drivers/gpib/gpio/gpib_bitbang.c
> @@ -64,7 +64,7 @@
> #include <linux/gpio/consumer.h>
> #include <linux/gpio/driver.h>
> #include <linux/gpio/machine.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
[Severity: Low]
This isn't a bug, but does this introduce a duplicate include of
linux/gpio/consumer.h? It appears to already be included a few lines above.
Similar duplicate includes might have been added to other files like
drivers/input/keyboard/matrix_keypad.c and drivers/net/phy/mdio_device.c
if they were also part of this series.
> #include <linux/irq.h>
>
> static int sn7516x_used = 1, sn7516x;
While reviewing this file, I noticed a separate issue in bb_DAV_interrupt().
[Severity: High]
This is a pre-existing issue, but does this lack of a bounds check on
priv->count lead to a buffer overflow?
drivers/gpib/gpio/gpib_bitbang.c:bb_DAV_interrupt() {
...
priv->rbuf[priv->count++] = get_data_lines();
priv->end = !gpiod_get_value(EOI);
...
}
If the hardware line DAV goes low multiple times while priv->r_busy is set
without waiting for the normal NRFD/NDAC handshake, could priv->count exceed
the allocated buffer size and corrupt memory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629132633.1300009-1-arnd@kernel.org?part=12
More information about the linux-phy
mailing list