summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHaoyu Li <lihaoyu499@gmail.com>2024-12-03 22:14:51 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-29 14:07:06 +0100
commit2ae71c3770c39293b3d0ef540860026d9f5f0ee0 (patch)
tree3f16632b04eb0796b0aa11a9cb687ae542dbb6a5 /drivers
parentbfd17b6138df0122a95989457d8e18ce0b86165e (diff)
downloadlinux-2ae71c3770c39293b3d0ef540860026d9f5f0ee0.tar.gz
linux-2ae71c3770c39293b3d0ef540860026d9f5f0ee0.tar.bz2
linux-2ae71c3770c39293b3d0ef540860026d9f5f0ee0.zip
gpio: ljca: Initialize num before accessing item in ljca_gpio_config
commit 3396995f9fb6bcbe0004a68118a22f98bab6e2b9 upstream. With the new __counted_by annocation in ljca_gpio_packet, the "num" struct member must be set before accessing the "item" array. Failing to do so will trigger a runtime warning when enabling CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Fixes: 1034cc423f1b ("gpio: update Intel LJCA USB GPIO driver") Cc: stable@vger.kernel.org Signed-off-by: Haoyu Li <lihaoyu499@gmail.com> Link: https://lore.kernel.org/stable/20241203141451.342316-1-lihaoyu499%40gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-ljca.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-ljca.c b/drivers/gpio/gpio-ljca.c
index ddd73b8b790e..c3a595c6f6c7 100644
--- a/drivers/gpio/gpio-ljca.c
+++ b/drivers/gpio/gpio-ljca.c
@@ -82,9 +82,9 @@ static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
int ret;
mutex_lock(&ljca_gpio->trans_lock);
+ packet->num = 1;
packet->item[0].index = gpio_id;
packet->item[0].value = config | ljca_gpio->connect_mode[gpio_id];
- packet->num = 1;
ret = ljca_transfer(ljca_gpio->ljca, LJCA_GPIO_CONFIG, (u8 *)packet,
struct_size(packet, item, packet->num), NULL, 0);