From: Kees Cook <keescook@chromium.org>
To: Joe Perches <joe@perches.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: Re: [PATCH v2] overflow.h: Add flex_array_size() helper
Date: Tue, 9 Jun 2020 08:42:11 -0700 [thread overview]
Message-ID: <202006090841.83B5989A9@keescook> (raw)
In-Reply-To: <e32b0a42aa00c20ef3868edd987c39a95ba68e95.camel@perches.com>
On Mon, Jun 08, 2020 at 11:47:03PM -0700, Joe Perches wrote:
> On Mon, 2020-06-08 at 20:22 -0500, Gustavo A. R. Silva wrote:
> > Add flex_array_size() helper for the calculation of the size, in bytes,
> > of a flexible array member contained within an enclosing structure.
> []
> > diff --git a/include/linux/overflow.h b/include/linux/overflow.h
> []
> > +/**
> > + * flex_array_size() - Calculate size, in bytes, of a flexible array member
> > + * within an enclosing structure. Read on for more details.
>
> IMO: "Read on for more details" isn't useful here.
> Perhaps better would be something like:
>
> * flex_array_size() - size of a flexible array (sizeof(typeof(member)) * count)
>
> > + *
> > + * @p: Pointer to the structure.
> > + * @member: Name of the flexible array member.
> > + * @count: Number of elements in the array.
> > + *
> > + * Calculates size, in bytes, of a flexible array @member of @count elements
>
> IMO: "in bytes, " is redundant. size is always bytes.
While yes, that's the expected unit, I don't mind the clarification
given that we want to be distinct from "count" and the size of an
individual array element.
--
Kees Cook
next prev parent reply other threads:[~2020-06-09 15:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 1:22 [PATCH v2] overflow.h: Add flex_array_size() helper Gustavo A. R. Silva
2020-06-09 6:47 ` Joe Perches
2020-06-09 15:42 ` Kees Cook [this message]
2020-06-10 21:38 ` Kees Cook
2020-06-16 20:48 ` Gustavo A. R. Silva
2020-06-17 3:48 ` Kees Cook
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=202006090841.83B5989A9@keescook \
--to=keescook@chromium.org \
--cc=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=joe@perches.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox