All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: Re: [PATCH] docs: deprecated.rst: Add note to the use of struct_size() helper
Date: Thu, 4 Jun 2020 14:33:47 -0700	[thread overview]
Message-ID: <202006041433.7065E1A7@keescook> (raw)
In-Reply-To: <20200604211903.GF10051@embeddedor>

On Thu, Jun 04, 2020 at 04:19:03PM -0500, Gustavo A. R. Silva wrote:
> On Thu, Jun 04, 2020 at 01:25:26PM -0700, Kees Cook wrote:
> > On Thu, Jun 04, 2020 at 01:21:23PM -0500, Gustavo A. R. Silva wrote:
> > > Yeah. My reasoning for is that it will take a while --at least one 
> > > development cycle more-- to completely get rid of all the 0/1-arrays.
> > 
> > Right -- but we need a place to point people when we tell them "please
> > don't use 0-byte and 1-byte arrays", and the deprecated.rst is the place
> > for that.
> > 
> > Having it in deprecated.rst once they're all gone only serves to explain
> > why various compiler flags are enabled, etc. But while they're being
> > removed, it serves as a single place to document the issue (as in, much
> > of the flex-array patch commit log "boilerplate" can actually be
> > repeated in deprecated.rst.
> > 
> > > But I think we can add this note while I continue working on the flexible-array
> > > conversions. Once that work is complete, I can go back and update the
> > > documentation. :)
> > > 
> > > What do you think?
> > 
> > I think we need to document it at the beginning of the work (and I
> > should have asked for this earlier). So let's just add a new section on
> > dynamic array usage, etc. It can include a note about struct_size() as
> > an example for why 1-byte arrays are so weird. :)
> > 
> 
> Got ya. :)
> 
> One last thing... I was thinking on adding such section (dynamic array
> usage) to coding-style.rst, explaining how to use struct_size() and
> transform the different open-coded versions we currently have in the
> kernel, e.g. I have seen people use offsetof() --and sometimes open-coded
> versions of sizeof_field()-- and its open-coded version to do arithmetic
> in allocator arguments.

Yeah, that sounds good to me!

-Kees

> 
> Thanks
> --
> Gustavo
> 

-- 
Kees Cook

      reply	other threads:[~2020-06-04 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 17:21 [PATCH] docs: deprecated.rst: Add note to the use of struct_size() helper Gustavo A. R. Silva
2020-06-04 17:49 ` Kees Cook
2020-06-04 18:21   ` Gustavo A. R. Silva
2020-06-04 20:25     ` Kees Cook
2020-06-04 21:19       ` Gustavo A. R. Silva
2020-06-04 21:33         ` 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=202006041433.7065E1A7@keescook \
    --to=keescook@chromium.org \
    --cc=corbet@lwn.net \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.