Skip to contentSkip to conversation

can: etas_es58x: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

PATCH Applied Gustavo A. R. Silva 4 participants 4 messages Aug 29, 2022 – Sep 6, 2022

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

PATCH 1/1 can: etas_es58x: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in union es58x_urb_cmd with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

---
 drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/etas_es58x/es58x_core.h +1 -1
index d769bdf740b7..640fe0a1df63 100644
@@ -222,7 +222,7 @@ union es58x_urb_cmd {
 		u8 cmd_type;
 		u8 cmd_id;
 	} __packed;
-	u8 raw_cmd[0];
+	DECLARE_FLEX_ARRAY(u8, raw_cmd);
 };
 
 /**
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in union es58x_urb_cmd with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

Signature · 1 line
Kees Cook
#2 lore raw
Quoted 6 lines · Kees Cook
Quoted 5 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in union es58x_urb_cmd with the new DECLARE_FLEX_ARRAY() helper macro.

Quoted 7 lines
Quoted 5 lines

This helper allows for a flexible-array member in a union.

Yours sincerely,
Vincent Mailhol

maintainer Applied
#3 lore raw
In reply to Gustavo A. R. Silva
Quoted 10 lines · Gustavo A. R. Silva

Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in union es58x_urb_cmd with the new DECLARE_FLEX_ARRAY() helper macro.

This helper allows for a flexible-array member in a union.

Applied to linux-can-next.

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |