Linux USB
 help / color / mirror / Atom feed
* [PATCH 1/3] usb: typec: anx7411: Fix an array out of bounds
@ 2022-07-22  6:25 Dan Carpenter
  2022-07-22  6:29 ` [PATCH 2/3] usb: typec: anx7411: fix error checking in anx7411_get_gpio_irq() Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-07-22  6:25 UTC (permalink / raw)
  To: Heikki Krogerus, Xin Ji; +Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors

This should be ARRAY_SIZE() instead of sizeof().  ARRAY_SIZE is
4 and  sizeof is 8.

Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/typec/anx7411.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index b990376991f8..4f7a5cc968d0 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -992,7 +992,7 @@ static int anx7411_register_i2c_dummy_clients(struct anx7411_data *ctx,
 	int i;
 	u8 spi_addr;
 
-	for (i = 0; i < sizeof(anx7411_i2c_addr); i++) {
+	for (i = 0; i < ARRAY_SIZE(anx7411_i2c_addr); i++) {
 		if (client->addr == (anx7411_i2c_addr[i].tcpc_address >> 1)) {
 			spi_addr = anx7411_i2c_addr[i].spi_address >> 1;
 			ctx->spi_client = i2c_new_dummy_device(client->adapter,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-22  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22  6:25 [PATCH 1/3] usb: typec: anx7411: Fix an array out of bounds Dan Carpenter
2022-07-22  6:29 ` [PATCH 2/3] usb: typec: anx7411: fix error checking in anx7411_get_gpio_irq() Dan Carpenter
2022-07-22  7:16   ` Xin Ji
2022-07-22  6:29 ` [PATCH 3/3] usb: typec: anx7411: use semi-colons instead of commas Dan Carpenter
2022-07-22  7:17   ` Xin Ji
2022-07-22  7:15 ` [PATCH 1/3] usb: typec: anx7411: Fix an array out of bounds Xin Ji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox