From: sashiko-bot@kernel.org
To: "Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v10 3/3] gpio: gpio-ltc4283: Add support for the LTC4283 Swap Controller
Date: Wed, 29 Apr 2026 00:25:02 +0000 [thread overview]
Message-ID: <20260429002504.29322C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260428-ltc4283-support-v10-3-4f26f46491c3@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Unchecked NULL pointer dereference in ltc4283_init_valid_mask() leads to guaranteed kernel panic on probe.
- [Medium] Hardware glitch in ltc4283_gpio_direction_output() caused by setting pin direction before the output value.
--
commit b21abd683d70453a9fa63ff159113ec69ce2380a
Author: Nuno Sá <nuno.sa@analog.com>
gpio: gpio-ltc4283: Add support for the LTC4283 Swap Controller
This commit introduces a driver for the GPIO functionality found on the
LTC4283 Negative Voltage Hot Swap Controller. It provides support for up to
8 pins configured via an auxiliary bus.
> diff --git a/drivers/gpio/gpio-ltc4283.c b/drivers/gpio/gpio-ltc4283.c
> new file mode 100644
> index 000000000000..6609443c5d62
> --- /dev/null
> +++ b/drivers/gpio/gpio-ltc4283.c
[ ... ]
> +static int ltc4283_gpio_direction_output(struct gpio_chip *gc, unsigned int off, int val)
> +{
> + struct ltc4283_gpio *st = gpiochip_get_data(gc);
> + int ret;
> +
> + ret = ltc4283_gpio_direction_set(st, off, false);
> + if (ret)
> + return ret;
> +
> + return __ltc4283_gpio_set_value(st, off, val);
> +}
Will this cause a transient hardware glitch on the output pin?
If ltc4283_gpio_direction_set() configures the pin as an output before
__ltc4283_gpio_set_value() establishes the intended logic level, the pin
might temporarily drive a stale value from the output data register.
Since the registers are accessed via an I2C regmap, there is a measurable
delay between these two operations. Would it be safer to reverse the order
and set the output value before changing the pin direction?
[ ... ]
> +static int ltc4283_init_valid_mask(struct gpio_chip *gc, unsigned long *valid_mask,
> + unsigned int ngpios)
> +{
> + unsigned long *mask = dev_get_platdata(gc->parent);
> +
> + bitmap_copy(valid_mask, mask, ngpios);
> + return 0;
> +}
Will this cause a NULL pointer dereference during device probe?
If the parent driver creates the auxiliary device without setting
platform_data, dev_get_platdata() returns NULL. Passing this directly to
bitmap_copy() as the source argument:
include/linux/bitmap.h:bitmap_copy()
if (small_const_nbits(nbits))
*dst = *src;
will dereference the NULL pointer. Should there be a check to verify mask
is valid before copying it?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260428-ltc4283-support-v10-0-4f26f46491c3@analog.com?part=3
prev parent reply other threads:[~2026-04-29 0:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 16:07 [PATCH v10 0/3] hwmon: Add support for the LTC4283 Hot Swap Controller Nuno Sá via B4 Relay
2026-04-28 16:07 ` [PATCH v10 1/3] dt-bindings: hwmon: Document the LTC4283 " Nuno Sá via B4 Relay
2026-04-28 16:07 ` [PATCH v10 2/3] hwmon: ltc4283: Add support for " Nuno Sá via B4 Relay
2026-04-29 0:03 ` sashiko-bot
2026-04-29 12:33 ` Nuno Sá
2026-04-29 13:09 ` Guenter Roeck
2026-04-28 16:07 ` [PATCH v10 3/3] gpio: gpio-ltc4283: " Nuno Sá via B4 Relay
2026-04-29 0:25 ` sashiko-bot [this message]
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=20260429002504.29322C2BCAF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=devnull+nuno.sa.analog.com@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko@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