Re: [PATCH v2 2/4] string: Allow 2-argument strscpy()

2024-02-05 Thread Geert Uytterhoeven
Hi Kees, On Mon, Feb 5, 2024 at 2:01 PM Kees Cook wrote: > On Mon, Feb 05, 2024 at 01:47:08PM +0100, Geert Uytterhoeven wrote: > > > +/* > > > + * The 2 argument style can only be used when dst is an array with a > > > + * known size. > > > + */ > > > +#define __strscpy0(dst, src, ...) \ > >

Re: [PATCH v2 2/4] string: Allow 2-argument strscpy()

2024-02-05 Thread Kees Cook
On Mon, Feb 05, 2024 at 01:47:08PM +0100, Geert Uytterhoeven wrote: > > +/* > > + * The 2 argument style can only be used when dst is an array with a > > + * known size. > > + */ > > +#define __strscpy0(dst, src, ...) \ > > + sized_strscpy(dst, src, sizeof(dst) + __must_be_array(dst)) >

Re: [PATCH v2 2/4] string: Allow 2-argument strscpy()

2024-02-05 Thread Andy Shevchenko
On Mon, Feb 05, 2024 at 01:47:08PM +0100, Geert Uytterhoeven wrote: > On Mon, Feb 5, 2024 at 1:37 PM Kees Cook wrote: ... > > +#define __strscpy1(dst, src, size) sized_strscpy(dst, src, size) > > (dst), (src), (size) etc. No need. ... > > +#define strscpy(dst, src, ...) \ > > + CON

Re: [PATCH v2 2/4] string: Allow 2-argument strscpy()

2024-02-05 Thread Geert Uytterhoeven
Hi Kees, On Mon, Feb 5, 2024 at 1:37 PM Kees Cook wrote: > Using sizeof(dst) for the "size" argument in strscpy() is the > overwhelmingly common case. Instead of requiring this everywhere, allow a > 2-argument version to be used that will use the sizeof() internally. There > are other functions i