Re: [PATCH] leds: gpio: Set num_leds after allocation

2024-08-23 Thread Lee Jones
On Thu, 22 Aug 2024, Kees Cook wrote: > On Thu, Jul 25, 2024 at 11:22:40AM +0100, Lee Jones wrote: > > On Tue, 16 Jul 2024, Gustavo A. R. Silva wrote: > > > > > > > > > > > On 16/07/24 15:24, Kees Cook wrote: > > > > With the new __counted_by annotation, the "num_leds" variable needs to > > > >

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

2024-08-23 Thread Lee Jones
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 v

Re: [PATCH] leds: gpio: Set num_leds after allocation

2024-08-22 Thread Kees Cook
On Thu, Jul 25, 2024 at 11:22:40AM +0100, Lee Jones wrote: > On Tue, 16 Jul 2024, Gustavo A. R. Silva wrote: > > > > > > > On 16/07/24 15:24, Kees Cook wrote: > > > With the new __counted_by annotation, the "num_leds" variable needs to > > > valid for accesses to the "leds" array. This requireme

Re: [PATCH] leds: gpio: Set num_leds after allocation

2024-07-25 Thread Lee Jones
On Tue, 16 Jul 2024, Gustavo A. R. Silva wrote: > > > On 16/07/24 15:24, 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",

Re: [PATCH] leds: gpio: Set num_leds after allocation

2024-07-16 Thread Gustavo A. R. Silva
On 16/07/24 15:24, 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

[PATCH] leds: gpio: Set num_leds after allocation

2024-07-16 Thread Kees Cook
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"). Fi