linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] docs: deprecated.rst: Add note about DECLARE_FLEX_ARRAY() usage
Date: Thu, 12 Jan 2023 11:38:25 -0800	[thread overview]
Message-ID: <202301121138.0A591928@keescook> (raw)
In-Reply-To: <87r0w0vf82.fsf@meer.lwn.net>

On Wed, Jan 11, 2023 at 04:11:41PM -0700, Jonathan Corbet wrote:
> Kees Cook <keescook@chromium.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@wanadoo.fr>
> > Cc: Jonathan Corbet <corbet@lwn.net>
> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
> > Cc: linux-doc@vger.kernel.org
> > Signed-off-by: Kees Cook <keescook@chromium.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.

Thank you; I appreciate the help! :)

-- 
Kees Cook

      reply	other threads:[~2023-01-12 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 20:06 [PATCH] docs: deprecated.rst: Add note about DECLARE_FLEX_ARRAY() usage Kees Cook
2023-01-11 23:11 ` Jonathan Corbet
2023-01-12 19:38   ` Kees Cook [this message]

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=202301121138.0A591928@keescook \
    --to=keescook@chromium.org \
    --cc=corbet@lwn.net \
    --cc=gustavoars@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    /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).