[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve=bnGQR=mf2B-uPKjhwcOhBr6O=7Q-wm5AWSShOg+urQ@mail.gmail.com>
Date: Tue, 30 Jan 2024 01:30:47 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Justin Stitt <justinstitt@...gle.com>, Andy Shevchenko <andy@...nel.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] string: Allow 2-argument strscpy()
On Tue, Jan 30, 2024 at 1:27 AM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Tue, Jan 30, 2024 at 12:03 AM Kees Cook <keescook@...omium.org> wrote:
> > On Mon, Jan 29, 2024 at 09:55:25PM +0000, Justin Stitt wrote:
> > > On Mon, Jan 29, 2024 at 12:29:04PM -0800, Kees Cook wrote:
...
> > > BTW, this hack for function overloading is insane. Never really looked into
> > > it before.
> >
> > It very much is. :P Hence the RFC nature of this patch. I don't think we
> > any any other API in the kernel that does this (though there are plenty
> > of wild macro wrappers to do similar tricks, like the syscall wrappers).
>
> PCI has a couple of such.
>
> > > I like this, though, should you include documentation changes/additions?
> >
> > Yeah, though I'm not sure how to do this -- kerndoc expects a fixed
> > number of arguments. :P Maybe I can just do something like add
> > "optional" to @size:
>
> Use ... See again PCI header (pci.h). One of the macros there has a
> valid kernel-doc.
>
> > * strscpy - Copy a C-string into a sized buffer
> > * @p: Where to copy the string to
> > * @q: Where to copy the string from
> > * @size: Size of destination buffer (optional)
FWIW,
https://elixir.bootlin.com/linux/latest/source/include/linux/pci.h#L1517
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists