Re: [PATCH v2] gpio: line-mux: fix unsigned truncation of property count error
From: Bartosz Golaszewski
Date: Tue Nov 10 2026 - 12:15:42 EST
On Tue, Nov 10, 2026 at 10:57:42PM +0800, shao.mingyin@xxxxxxxxxx wrote:
> From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
>
> device_property_count_u32() returns an int and reports errors with a
> negative errno (e.g. -EINVAL when the "gpio-line-mux-states" property is
> missing). Storing that into an unsigned int turns -EINVAL into a huge
> value, so the "if (!ngpio)" guard never triggers and struct_size() then
> computes a huge size. The allocation fails with -ENOMEM, hiding the
> real error; struct_size() saturates on overflow, so this is not an
> undersized allocation on 32-bit builds either.
>
> Use a signed int for the count, propagate the property-array error, and
> reject a zero count.
>
> Fixes: 2b03d9a40cd1 ("gpio: add gpio-line-mux driver")
> Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
> Reviewed-by: Jonas Jelonek <jelonek.jonas@xxxxxxxxx>
> ---
> This patch supersedes 5/5 of the v1 series; 1/5 has been withdrawn and
> 2/5-4/5 are unchanged.
>
When sending a new version of a series, you must include all patches, even if
some of them didn't change. You can't expect maintainers to comb through
lore.kernel.org in search of all the pieces.
Please resend it as a complete series.
Bartosz