linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Ming Qian <ming.qian@nxp.com>, Shijie Qin <shijie.qin@nxp.com>,
	Zhou Peng <eagle.zhou@nxp.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] media: amphion: Replace zero-length array with flexible-array member
Date: Fri, 27 May 2022 17:08:54 -0500	[thread overview]
Message-ID: <20220527220854.GA72220@embeddedor> (raw)
In-Reply-To: <20220527212953.797574-1-keescook@chromium.org>

On Fri, May 27, 2022 at 02:29:53PM -0700, Kees Cook wrote:
> There is a regular need in the kernel to provide a way to declare
> having a dynamically sized set of trailing elements in a structure.
> Kernel code should always use “flexible array members”[1] for these
> cases. The older style of one-element or zero-length arrays should no
> longer be used[2][3].
> 
> [1] https://en.wikipedia.org/wiki/Flexible_array_member
> [2] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
> [3] https://github.com/KSPP/linux/issues/78
> 
> Fixes: 9f599f351e86 ("media: amphion: add vpu core driver")
> Cc: Ming Qian <ming.qian@nxp.com>
> Cc: Shijie Qin <shijie.qin@nxp.com>
> Cc: Zhou Peng <eagle.zhou@nxp.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
--
Gustavo

> ---
>  drivers/media/platform/amphion/vpu_dbg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c
> index da62bd718fb8..f72c8a506b22 100644
> --- a/drivers/media/platform/amphion/vpu_dbg.c
> +++ b/drivers/media/platform/amphion/vpu_dbg.c
> @@ -27,7 +27,7 @@ struct print_buf_desc {
>  	u32 bytes;
>  	u32 read;
>  	u32 write;
> -	char buffer[0];
> +	char buffer[];
>  };
>  
>  static char *vb2_stat_name[] = {
> -- 
> 2.32.0
> 

  reply	other threads:[~2022-05-27 21:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 21:29 [PATCH] media: amphion: Replace zero-length array with flexible-array member Kees Cook
2022-05-27 22:08 ` Gustavo A. R. Silva [this message]
2022-05-30  5:15 ` [EXT] " Ming Qian
2022-05-30 11:27 ` Tommaso Merciai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527220854.GA72220@embeddedor \
    --to=gustavoars@kernel.org \
    --cc=eagle.zhou@nxp.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=shijie.qin@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).