[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210115122000.430414543@linuxfoundation.org>
Date: Fri, 15 Jan 2021 13:28:04 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jean Delvare <jdelvare@...e.de>,
Linus Walleij <linus.walleij@...aro.org>,
Wolfram Sang <wsa@...nel.org>
Subject: [PATCH 5.4 42/62] i2c: i801: Fix the i2c-mux gpiod_lookup_table not being properly terminated
From: Hans de Goede <hdegoede@...hat.com>
commit 0b3ea2a06de1f52ea30865e227e109a5fd3b6214 upstream.
gpiod_add_lookup_table() expects the gpiod_lookup_table->table passed to
it to be terminated with a zero-ed out entry.
So we need to allocate one more entry then we will use.
Fixes: d308dfbf62ef ("i2c: mux/i801: Switch to use descriptor passing")
Signed-off-by: Hans de Goede <hdegoede@...hat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
Acked-by: Jean Delvare <jdelvare@...e.de>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Wolfram Sang <wsa@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/i2c/busses/i2c-i801.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1424,7 +1424,7 @@ static int i801_add_mux(struct i801_priv
/* Register GPIO descriptor lookup table */
lookup = devm_kzalloc(dev,
- struct_size(lookup, table, mux_config->n_gpios),
+ struct_size(lookup, table, mux_config->n_gpios + 1),
GFP_KERNEL);
if (!lookup)
return -ENOMEM;
Powered by blists - more mailing lists