Skip to contentSkip to conversation

video: fbdev: via: remove VLA usage

PATCH In review Gustavo A. R. Silva 4 participants 5 messages Mar 8, 2018 – Mar 13, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: via: remove VLA usage

In preparation to enabling -Wvla, remove VLA usage.

Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621

---
 drivers/video/fbdev/via/via_aux_sii164.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1631.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1632.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1636.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/via/via_aux_sii164.c +1 -1
index ca1b35f..c27f62c 100644
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1631.c +1 -1
index 06e742f..32978a0 100644
@@ -36,7 +36,7 @@ void via_aux_vt1631_probe(struct via_aux_bus *bus)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1632.c +1 -1
index d24f4cd..cec8cc4 100644
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1636.c +1 -1
index 9e015c1..2b10bc2 100644
@@ -36,7 +36,7 @@ void via_aux_vt1636_probe(struct via_aux_bus *bus)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

In preparation to enabling -Wvla, remove VLA usage.

Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621

Sorry for my reply on v1, I missed that Emil already replied to another post of the same patch (side note on that, making use of -vX and --in-reply-to helps track the evolution of patches)

This looks good to me:

Quoted 66 lines
---
 drivers/video/fbdev/via/via_aux_sii164.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1631.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1632.c | 2 +-
 drivers/video/fbdev/via/via_aux_vt1636.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/via/via_aux_sii164.c +1 -1
index ca1b35f..c27f62c 100644
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1631.c +1 -1
index 06e742f..32978a0 100644
@@ -36,7 +36,7 @@ void via_aux_vt1631_probe(struct via_aux_bus *bus)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1632.c +1 -1
index d24f4cd..cec8cc4 100644
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
drivers/video/fbdev/via/via_aux_vt1636.c +1 -1
index 9e015c1..2b10bc2 100644
@@ -36,7 +36,7 @@ void via_aux_vt1636_probe(struct via_aux_bus *bus)
 		.name	=	name};
 	/* check vendor id and device id */
 	const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id);
-	u8 tmp[len];
+	u8 tmp[ARRAY_SIZE(id)];
 
 	if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
 		return;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by
#2 lore raw
Quoted 6 lines · Eric Engestrom
Quoted 5 lines · Gustavo A. R. Silva

In preparation to enabling -Wvla, remove VLA usage.

Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621

Quoted 9 lines
Quoted 1 line

Sorry for my reply on v1, I missed that Emil already replied to another post of the same patch (side note on that, making use of -vX and --in-reply-to helps track the evolution of patches)

This looks good to me:

Same here

-Emil

#3 lore raw
Quoted 13 lines · Emil Velikov
Quoted 12 lines · Eric Engestrom
Quoted 6 lines · Gustavo A. R. Silva

In preparation to enabling -Wvla, remove VLA usage.

Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621

Sorry for my reply on v1, I missed that Emil already replied to another post of the same patch (side note on that, making use of -vX and --in-reply-to helps track the evolution of patches)

Quoted 5 lines
Quoted 3 lines

This looks good to me:

Same here

Patch queued for 4.17, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#4 lore raw
In reply to Emil Velikov
Quoted 7 lines · Emil Velikov
Quoted 6 lines · Eric Engestrom
Quoted 5 lines · Gustavo A. R. Silva

In preparation to enabling -Wvla, remove VLA usage.

Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Sorry for my reply on v1, I missed that Emil already replied to another post of the same patch (side note on that, making use of -vX and --in-reply-to helps track the evolution of patches)

Yep. I know. It is just that some people prefer vX in a new thread. Anyway, I will take this into account for the next time.

Quoted 8 lines
Quoted 3 lines

This looks good to me:

Same here

-Emil

Thanks for reviewing it, guys.

Signature · 1 line
Gustavo A. R. Silva