Re: [PATCH 6/9] fortify: Split reporting and avoid passing string pointer

From: Andy Shevchenko
Date: Fri Apr 07 2023 - 04:35:35 EST


On Fri, Apr 7, 2023 at 1:57 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> On Thu, Apr 06, 2023 at 01:20:52PM +0300, Andy Shevchenko wrote:
> > On Thu, Apr 6, 2023 at 3:02 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:

...

> > > + WARN(1, "%s: detected buffer %s overflow\n", name, write ? "write" : "read");
> >
> > Using str_read_write() ?
> >
> > Dunno if it's already there or needs to be added. I have some patches
> > to move those str_*() to string_choices.h. We can also prepend yours
> > with those.
>
> Oh! Hah. I totally forgot about str_read_write. :) I will use that.

Btw, makes sense to add

#define str_write_read(v) str_read_write(!(v))

to the header, so we won't use negation in the parameter for better readability.

--
With Best Regards,
Andy Shevchenko