Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-04-05 Thread Kent Overstreet
On Wed, Mar 26, 2025 at 06:02:31PM +0800, Alan Huang wrote: > On Mar 26, 2025, at 17:44, Roxana Nicolescu > wrote: > > > > strncpy() is deprecated for NUL-terminated destination buffers. Use > > strscpy() instead. > > > > Link: https://github.com/KSPP/linux/issues/90 > > Signed-off-by: Roxana N

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-04-05 Thread Alan Huang
On Mar 27, 2025, at 00:17, Kent Overstreet wrote: > > On Wed, Mar 26, 2025 at 09:19:06PM +0530, Bharadwaj Raju wrote: >> On Wed, Mar 26, 2025 at 8:22 PM Kent Overstreet >> wrote: >>> Or better, a new helper: when we're copying to a fixed size buffer we >>> really want to zero out the rest of the

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Kent Overstreet
On Wed, Mar 26, 2025 at 02:40:22PM +, Roxana Nicolescu wrote: > On Wednesday, March 26th, 2025 at 1:19 PM, Kent Overstreet > wrote: > > > On Wed, Mar 26, 2025 at 06:02:31PM +0800, Alan Huang wrote: > > > > > On Mar 26, 2025, at 17:44, Roxana Nicolescu > > > nicolescu.rox...@protonmail.com

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Roxana Nicolescu
On Wednesday, March 26th, 2025 at 5:41 PM, Kent Overstreet wrote: > On Thu, Mar 27, 2025 at 12:36:25AM +0800, Alan Huang wrote: > > > On Mar 27, 2025, at 00:17, Kent Overstreet kent.overstr...@linux.dev wrote: > > > > > On Wed, Mar 26, 2025 at 09:19:06PM +0530, Bharadwaj Raju wrote: > > > > >

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Kent Overstreet
On Thu, Mar 27, 2025 at 12:36:25AM +0800, Alan Huang wrote: > On Mar 27, 2025, at 00:17, Kent Overstreet wrote: > > > > On Wed, Mar 26, 2025 at 09:19:06PM +0530, Bharadwaj Raju wrote: > >> On Wed, Mar 26, 2025 at 8:22 PM Kent Overstreet > >> wrote: > >>> Or better, a new helper: when we're copyi

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Kent Overstreet
On Wed, Mar 26, 2025 at 09:19:06PM +0530, Bharadwaj Raju wrote: > On Wed, Mar 26, 2025 at 8:22 PM Kent Overstreet > wrote: > > Or better, a new helper: when we're copying to a fixed size buffer we > > really want to zero out the rest of the buffer - we don't just want a > > single terminating nul.

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Bharadwaj Raju
On Wed, Mar 26, 2025 at 8:22 PM Kent Overstreet wrote: > Or better, a new helper: when we're copying to a fixed size buffer we > really want to zero out the rest of the buffer - we don't just want a > single terminating nul. I believe strscpy_pad does this? https://docs.kernel.org/core-api/kerne

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Roxana Nicolescu
On Wednesday, March 26th, 2025 at 1:19 PM, Kent Overstreet wrote: > On Wed, Mar 26, 2025 at 06:02:31PM +0800, Alan Huang wrote: > > > On Mar 26, 2025, at 17:44, Roxana Nicolescu nicolescu.rox...@protonmail.com > > wrote: > > > > > strncpy() is deprecated for NUL-terminated destination buffers

Re: [PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Alan Huang
On Mar 26, 2025, at 17:44, Roxana Nicolescu wrote: > > strncpy() is deprecated for NUL-terminated destination buffers. Use > strscpy() instead. > > Link: https://github.com/KSPP/linux/issues/90 > Signed-off-by: Roxana Nicolescu > --- > fs/bcachefs/btree_trans_commit.c | 2 +- > 1 file changed,

[PATCH] bcachefs: replace deprecated strncpy() with strscpy()

2025-03-26 Thread Roxana Nicolescu
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead. Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Roxana Nicolescu --- fs/bcachefs/btree_trans_commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/btree_trans_co

Re: [PATCH] bcachefs: replace deprecated strncpy with strscpy

2024-11-13 Thread Daniel Yang
On Wed, Nov 13, 2024 at 6:21 PM Kent Overstreet wrote: > strncpy is correct here, we don't need the output to be nul terminated If dest is not NULL terminated, then core API recommends using strtomem instead.

Re: [PATCH] bcachefs: replace deprecated strncpy with strscpy

2024-11-13 Thread Kent Overstreet
On Tue, Nov 12, 2024 at 11:42:48PM -0800, Daniel Yang wrote: > The function strncpy is deprecated due to not guaranteeing the > destination buffer will be NULL-terminated. The recommended replacement > is to use strscpy(). strncpy is correct here, we don't need the output to be nul terminated

[PATCH] bcachefs: replace deprecated strncpy with strscpy

2024-11-12 Thread Daniel Yang
The function strncpy is deprecated due to not guaranteeing the destination buffer will be NULL-terminated. The recommended replacement is to use strscpy(). Signed-off-by: Daniel Yang --- fs/bcachefs/btree_trans_commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcach