[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0w0vf82.fsf@meer.lwn.net>
Date: Wed, 11 Jan 2023 16:11:41 -0700
From: Jonathan Corbet <corbet@....net>
To: Kees Cook <keescook@...omium.org>
Cc: Kees Cook <keescook@...omium.org>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] docs: deprecated.rst: Add note about
DECLARE_FLEX_ARRAY() usage
Kees Cook <keescook@...omium.org> writes:
> There wasn't any mention of when/where DECLARE_FLEX_ARRAY() should be
> used, so add the rationale and an example to the deprecation docs.
>
> Suggested-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: linux-doc@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> Documentation/process/deprecated.rst | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
I've applied this, but couldn't resist making one tweak...
> diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst
> index c8fd53a11a20..fcac0a929efa 100644
> --- a/Documentation/process/deprecated.rst
> +++ b/Documentation/process/deprecated.rst
> @@ -346,3 +346,29 @@ struct_size() and flex_array_size() helpers::
> instance->count = count;
>
> memcpy(instance->items, source, flex_array_size(instance, items, instance->count));
> +
> +There are two special cases of replacement where the DECLARE_FLEX_ARRAY()
> +helper needs to be used. (Note that it is named __DECLARE_FLEX_ARRAY() for
> +use in UAPI headers.) When the flexible array is either alone in a struct,
> +or is part of a union.
The pedant in me couldn't stand leaving that sentence fragment, so I
made a complete sentence out of it.
Thanks,
jon
Powered by blists - more mailing lists