[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202006090841.83B5989A9@keescook>
Date: Tue, 9 Jun 2020 08:42:11 -0700
From: Kees Cook <keescook@...omium.org>
To: Joe Perches <joe@...ches.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: Re: [PATCH v2] overflow.h: Add flex_array_size() helper
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
Powered by blists - more mailing lists