[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202502061333.302D4EA68@keescook>
Date: Thu, 6 Feb 2025 13:34:35 -0800
From: Kees Cook <kees@...nel.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Suren Baghdasaryan <surenb@...gle.com>,
Kent Overstreet <kent.overstreet@...ux.dev>,
Andy Shevchenko <andy@...nel.org>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Philipp Reisner <philipp.reisner@...bit.com>,
Miguel Ojeda <ojeda@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH 2/3] compiler.h: Introduce __must_be_char_array()
On Thu, Feb 06, 2025 at 07:56:58PM +0000, David Laight wrote:
> On Thu, 6 Feb 2025 10:11:29 -0800
> Kees Cook <kees@...nel.org> wrote:
>
> > In preparation for adding stricter type checking to the str/mem*()
> > helpers, provide a way to check that a variable is a character array
> > via __must_be_char_array().
> >
> ...
> > +#define __is_char_array(a) (__is_array(a) && sizeof((a)[0]) == 1)
> > +#define __must_be_char_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_char_array(a), \
> > + "must be byte array")
>
> If you are only checking the size, perhaps __is_byte_array() would
> be a better name.
> (You've even used 'byte' in the error message.)
Yeah, fair point. I went and forth on naming. Fixed for v2.
--
Kees Cook
Powered by blists - more mailing lists