Re: (subset) [PATCH] leds: gpio: Set num_leds after allocation

From: Lee Jones
Date: Fri Aug 23 2024 - 03:41:28 EST


On Tue, 16 Jul 2024 14:24:59 -0700, Kees Cook wrote:
> With the new __counted_by annotation, the "num_leds" variable needs to
> valid for accesses to the "leds" array. This requirement is not met in
> gpio_leds_create(), since "num_leds" starts at "0", so "leds" index "0"
> will not be considered valid (num_leds would need to be "1" to access
> index "0").
>
> Fix this by setting the allocation size after allocation, and then update
> the final count based on how many were actually added to the array.
>
> [...]

Applied, thanks!

[1/1] leds: gpio: Set num_leds after allocation
commit: 045391a02bd971d431c83ad03f7cc51b6e2fe331

--
Lee Jones [李琼斯]