summaryrefslogtreecommitdiff
path: root/security/loadpin
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-07-17 00:24:59 +0300
committerLee Jones <lee@kernel.org>2024-08-23 10:40:43 +0300
commit045391a02bd971d431c83ad03f7cc51b6e2fe331 (patch)
tree2c4bdd3e72cb9d210d4fa782842ba4fa3dc9c5c8 /security/loadpin
parente5ae4083d32d9ba196c7452814bed5e5aa0731ec (diff)
downloadlinux-045391a02bd971d431c83ad03f7cc51b6e2fe331.tar.xz
leds: gpio: Set num_leds after allocation
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. Fixes: 52cd75108a42 ("leds: gpio: Annotate struct gpio_leds_priv with __counted_by") Signed-off-by: Kees Cook <kees@kernel.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20240716212455.work.809-kees@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'security/loadpin')
0 files changed, 0 insertions, 0 deletions