Re: [PATCH] tty: Replace zero-length array with flexible-array

From: Jiri Slaby
Date: Mon May 11 2020 - 02:07:23 EST


On 07. 05. 20, 21:25, Gustavo A. R. Silva wrote:
> The current codebase makes use of the zero-length array language
> extension to the C90 standard, but the preferred mechanism to declare
> variable-length types such as these ones is a flexible array member[1][2],
> introduced in C99:
>
> struct foo {
> int stuff;
> struct boo array[];
> };
...

Acked-by: Jiri Slaby <jslaby@xxxxxxx>

> Signed-off-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
> ---
> include/linux/tty.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/tty.h b/include/linux/tty.h
> index bd5fe0e907e8..a99e9b8e4e31 100644
> --- a/include/linux/tty.h
> +++ b/include/linux/tty.h
> @@ -66,7 +66,7 @@ struct tty_buffer {
> int read;
> int flags;
> /* Data points here */
> - unsigned long data[0];
> + unsigned long data[];
> };
>
> /* Values for .flags field of tty_buffer */
>

thanks,
--
js
suse labs