]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
gpio: timberdale: fix off-by-one in IRQ type boundary check
authorJunjie Cao <junjie.cao@intel.com>
Mon, 25 Aug 2025 09:08:50 +0000 (17:08 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 26 Aug 2025 10:03:09 +0000 (12:03 +0200)
commit810e154d90f44127239957b06ee51a55553a5815
tree2a9a6485b6f15a92441a15deb037d7a4ca78c0a1
parent1b237f190eb3d36f52dffe07a40b5eb210280e00
gpio: timberdale: fix off-by-one in IRQ type boundary check

timbgpio_irq_type() currently accepts offset == ngpio, violating
gpiolib's [0..ngpio-1] contract. This can lead to undefined behavior
when computing '1 << offset', and it is also inconsistent with users
that iterate with for_each_set_bit(..., ngpio).

Tighten the upper bound to reject offset == ngpio. No functional change
for in-range offsets.

Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Link: https://lore.kernel.org/r/20250825090850.127163-1-junjie.cao@intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-timberdale.c