On Thu, Feb 06, 2025 at 07:56:58PM +0000, David Laight wrote: > On Thu, 6 Feb 2025 10:11:29 -0800 > Kees Cook <[email protected]> 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
