diff mbox series

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

Message ID Yw00w6XRcq7B6ub6@work (mailing list archive)
State Mainlined
Commit 6fc5d84e6d85dcb3af6ba32c45fc65304946f134
Headers show
Series [next] can: etas_es58x: Replace zero-length array with DECLARE_FLEX_ARRAY() helper | expand

Commit Message

Gustavo A. R. Silva Aug. 29, 2022, 9:50 p.m. UTC
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.

Link: https://github.com/KSPP/linux/issues/193
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kees Cook Aug. 29, 2022, 10:06 p.m. UTC | #1
On Mon, Aug 29, 2022 at 04:50:59PM -0500, Gustavo A. R. Silva wrote:
> 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.
> 
> Link: https://github.com/KSPP/linux/issues/193
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>
Vincent Mailhol Aug. 30, 2022, 1:15 a.m. UTC | #2
On Tue. 30 Aug. 2022 at 07:15, Kees Cook <keescook@chromium.org> wrote:
> On Mon, Aug 29, 2022 at 04:50:59PM -0500, Gustavo A. R. Silva wrote:
> > 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.
> >
> > Link: https://github.com/KSPP/linux/issues/193
> > Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>

Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>


Yours sincerely,
Vincent Mailhol
Marc Kleine-Budde Sept. 6, 2022, 6:29 a.m. UTC | #3
On 29.08.2022 16:50:59, Gustavo A. R. Silva wrote:
> 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.
> 
> Link: https://github.com/KSPP/linux/issues/193
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Applied to linux-can-next.

Thanks,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h
index d769bdf740b7..640fe0a1df63 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.h
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.h
@@ -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);
 };
 
 /**