RE: [RFC] string: Allow 2-argument strscpy()

2024-02-10 Thread David Laight
From: Pavel Machek > Sent: 07 February 2024 17:52 > > > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > > > Instead of requiring this everywhere, allow a 2-argument version to be > > > used that will use the sizeof() internally. > > > > Yeah, this is definitely the case. I

RE: [RFC] string: Allow 2-argument strscpy()

2024-02-10 Thread David Laight
From: Pavel Machek > Sent: 07 February 2024 17:52 > > > > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > > > Instead of requiring this everywhere, allow a 2-argument version to be > > > used that will use the sizeof() internally. > > > > Yeah, this is definitely the case. I

Re: [RFC] string: Allow 2-argument strscpy()

2024-02-07 Thread Pavel Machek
Hi! > > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > > Instead of requiring this everywhere, allow a 2-argument version to be > > used that will use the sizeof() internally. > > Yeah, this is definitely the case. I have a ton of patches replacing > strncpy with strscpy

RE: [RFC] string: Allow 2-argument strscpy()

2024-02-01 Thread David Laight
From: Kees Cook > Sent: 29 January 2024 20:29 > > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > Instead of requiring this everywhere, allow a 2-argument version to be > used that will use the sizeof() internally. You may want to (try to) add a check that the first argument

Re: [RFC] string: Allow 2-argument strscpy()

2024-01-29 Thread Andy Shevchenko
On Tue, Jan 30, 2024 at 1:27 AM Andy Shevchenko wrote: > On Tue, Jan 30, 2024 at 12:03 AM Kees Cook wrote: > > On Mon, Jan 29, 2024 at 09:55:25PM +, Justin Stitt wrote: > > > On Mon, Jan 29, 2024 at 12:29:04PM -0800, Kees Cook wrote: ... > > > BTW, this hack for function overloading is

Re: [RFC] string: Allow 2-argument strscpy()

2024-01-29 Thread Andy Shevchenko
On Tue, Jan 30, 2024 at 12:03 AM Kees Cook wrote: > On Mon, Jan 29, 2024 at 09:55:25PM +, 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

Re: [RFC] string: Allow 2-argument strscpy()

2024-01-29 Thread Kees Cook
On Mon, Jan 29, 2024 at 09:55:25PM +, Justin Stitt wrote: > Hi, > > On Mon, Jan 29, 2024 at 12:29:04PM -0800, Kees Cook wrote: > > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > > Instead of requiring this everywhere, allow a 2-argument version to be > > used that will

Re: [RFC] string: Allow 2-argument strscpy()

2024-01-29 Thread Justin Stitt
Hi, On Mon, Jan 29, 2024 at 12:29:04PM -0800, Kees Cook wrote: > Using sizeof(dst) is the overwhelmingly common case for strscpy(). > Instead of requiring this everywhere, allow a 2-argument version to be > used that will use the sizeof() internally. Yeah, this is definitely the case. I have a

[RFC] string: Allow 2-argument strscpy()

2024-01-29 Thread Kees Cook
Using sizeof(dst) is the overwhelmingly common case for strscpy(). Instead of requiring this everywhere, allow a 2-argument version to be used that will use the sizeof() internally. Cc: Rasmus Villemoes Cc: Andy Shevchenko Cc: linux-hardening@vger.kernel.org Signed-off-by: Kees Cook --- What