* [PATCH next] misc: ti_fpc202: Fix off by one in probe()
@ 2025-04-23 8:22 Dan Carpenter
2025-04-23 10:49 ` Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-04-23 8:22 UTC (permalink / raw)
To: Romain Gantois
Cc: Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij, Wolfram Sang,
Andi Shyti, linux-kernel, kernel-janitors
The "port_id" is used as an array index into the struct fpc202_priv
priv->addr_caches[] array in fpc202_write_dev_addr(). It's a 2 by 2
array so if "port_id" is FPC202_NUM_PORTS (2) then it's one element
out of bounds. Change the > to >= to fix this bug.
Fixes: 1e5c9b1efa1c ("misc: add FPC202 dual port controller driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/misc/ti_fpc202.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
index b9c9ee4bfc4e..4e1871870769 100644
--- a/drivers/misc/ti_fpc202.c
+++ b/drivers/misc/ti_fpc202.c
@@ -370,7 +370,7 @@ static int fpc202_probe(struct i2c_client *client)
goto unregister_chans;
}
- if (port_id > FPC202_NUM_PORTS) {
+ if (port_id >= FPC202_NUM_PORTS) {
dev_err(dev, "port ID %d is out of range!\n", port_id);
ret = -EINVAL;
goto unregister_chans;
--
2.47.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] misc: ti_fpc202: Fix off by one in probe()
2025-04-23 8:22 [PATCH next] misc: ti_fpc202: Fix off by one in probe() Dan Carpenter
@ 2025-04-23 10:49 ` Arnd Bergmann
2025-04-23 13:05 ` Romain Gantois
2025-04-29 6:16 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-04-23 10:49 UTC (permalink / raw)
To: Dan Carpenter, Romain Gantois
Cc: Greg Kroah-Hartman, Linus Walleij, Wolfram Sang, Andi Shyti,
linux-kernel, kernel-janitors
On Wed, Apr 23, 2025, at 10:22, Dan Carpenter wrote:
> The "port_id" is used as an array index into the struct fpc202_priv
> priv->addr_caches[] array in fpc202_write_dev_addr(). It's a 2 by 2
> array so if "port_id" is FPC202_NUM_PORTS (2) then it's one element
> out of bounds. Change the > to >= to fix this bug.
>
> Fixes: 1e5c9b1efa1c ("misc: add FPC202 dual port controller driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] misc: ti_fpc202: Fix off by one in probe()
2025-04-23 8:22 [PATCH next] misc: ti_fpc202: Fix off by one in probe() Dan Carpenter
2025-04-23 10:49 ` Arnd Bergmann
@ 2025-04-23 13:05 ` Romain Gantois
2025-04-29 6:16 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Romain Gantois @ 2025-04-23 13:05 UTC (permalink / raw)
To: Dan Carpenter
Cc: Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij, Wolfram Sang,
Andi Shyti, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
On Wednesday, 23 April 2025 10:22:30 CEST Dan Carpenter wrote:
> The "port_id" is used as an array index into the struct fpc202_priv
> priv->addr_caches[] array in fpc202_write_dev_addr(). It's a 2 by 2
> array so if "port_id" is FPC202_NUM_PORTS (2) then it's one element
> out of bounds. Change the > to >= to fix this bug.
>
> Fixes: 1e5c9b1efa1c ("misc: add FPC202 dual port controller driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/misc/ti_fpc202.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index b9c9ee4bfc4e..4e1871870769 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -370,7 +370,7 @@ static int fpc202_probe(struct i2c_client *client)
> goto unregister_chans;
> }
>
> - if (port_id > FPC202_NUM_PORTS) {
> + if (port_id >= FPC202_NUM_PORTS) {
> dev_err(dev, "port ID %d is out of range!\n", port_id);
> ret = -EINVAL;
> goto unregister_chans;
Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] misc: ti_fpc202: Fix off by one in probe()
2025-04-23 8:22 [PATCH next] misc: ti_fpc202: Fix off by one in probe() Dan Carpenter
2025-04-23 10:49 ` Arnd Bergmann
2025-04-23 13:05 ` Romain Gantois
@ 2025-04-29 6:16 ` Andi Shyti
2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2025-04-29 6:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij,
Wolfram Sang, linux-kernel, kernel-janitors
Hi Dan,
On Wed, Apr 23, 2025 at 11:22:30AM +0300, Dan Carpenter wrote:
> The "port_id" is used as an array index into the struct fpc202_priv
> priv->addr_caches[] array in fpc202_write_dev_addr(). It's a 2 by 2
> array so if "port_id" is FPC202_NUM_PORTS (2) then it's one element
> out of bounds. Change the > to >= to fix this bug.
>
> Fixes: 1e5c9b1efa1c ("misc: add FPC202 dual port controller driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thanks,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-29 6:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-23 8:22 [PATCH next] misc: ti_fpc202: Fix off by one in probe() Dan Carpenter
2025-04-23 10:49 ` Arnd Bergmann
2025-04-23 13:05 ` Romain Gantois
2025-04-29 6:16 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®