Re: [PATCH] xfs: xattr: replace strncpy and check for truncation

2024-04-09 Thread Christoph Hellwig
On Fri, Apr 05, 2024 at 07:45:08PM +, Justin Stitt wrote: > - memcpy(offset, prefix, prefix_len); > - offset += prefix_len; > - strncpy(offset, (char *)name, namelen); /* real name */ > - offset += namelen; > - *offset = '\0'; > + > + combined_len =

Re: [PATCH] xfs: cleanup deprecated uses of strncpy

2024-04-02 Thread Christoph Hellwig
On Mon, Apr 01, 2024 at 11:01:38PM +, Justin Stitt wrote: > +++ b/fs/xfs/xfs_ioctl.c > @@ -1755,10 +1755,8 @@ xfs_ioc_getlabel( > /* Paranoia */ > BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX); > > - /* 1 larger than sb_fname, so this ensures a trailing NUL char */ > -

Re: [PATCH] md/md-multipath: Convert "struct mpconf" to flexible array

2023-12-11 Thread Christoph Hellwig
On Fri, Dec 08, 2023 at 10:11:10AM -0800, Song Liu wrote: > We marked it as deprecated about 2.5 years ago. But to be honest, > I currently don't have a plan to remove it. I guess I should start thinking > about it. Let's just kill it off ASAP. It never had a large user base and based by

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-06 Thread Christoph Hellwig
On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > Hmm...how does one know that linux/bits.h is the higher-level include > of asm/bitsperlong.h? I think this the wrong way of thinking. In general we should always avoid including asm/ headers unless there is no other way. No

Re: [PATCH v2] seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str()

2023-10-26 Thread Christoph Hellwig
On Thu, Oct 26, 2023 at 12:40:37PM -0700, Kees Cook wrote: > Solve two ergonomic issues with struct seq_buf; > > 1) Too much boilerplate is required to initialize: > > struct seq_buf s; > char buf[32]; > > seq_buf_init(s, buf, sizeof(buf)); > > Instead, we can build this

Re: the nul-terminated string helper desk chair rearrangement

2023-10-26 Thread Christoph Hellwig
On Fri, Oct 20, 2023 at 11:30:49AM -0700, Kees Cook wrote: > I'm curious where you looked and didn't find documentation -- perhaps > there is an improvement to be made to aim one to where the existing > documentation lives? My order was the following: - look for kernel doc on the main function

Re: [PATCH v2 1/1] trace: Move readpos from seq_buf to trace_seq

2023-10-19 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig

Re: the nul-terminated string helper desk chair rearrangement

2023-10-19 Thread Christoph Hellwig
On Wed, Oct 18, 2023 at 11:01:54PM -0700, Kees Cook wrote: > Almost all of the remaining strncpy() usage is just string to string > copying, but the corner cases that are being spun out that aren't > strscpy() or strscpy_pad() are covered by strtomem(), kmemdup_nul(), > and memcpy(). Each of these

the nul-terminated string helper desk chair rearrangement, was: Re: [PATCH] nvme-fabrics: replace deprecated strncpy with strscpy

2023-10-18 Thread Christoph Hellwig
On Wed, Oct 18, 2023 at 10:48:49PM +, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. If we want that we need to stop pretendening direct manipulation of

Re: [PATCH] nvmet-fc: Annotate struct nvmet_fc_tgt_queue with __counted_by

2023-10-05 Thread Christoph Hellwig
On Tue, Oct 03, 2023 at 04:25:11PM -0700, Kees Cook wrote: > struct workqueue_struct *work_q; > struct kref ref; > struct rcu_head rcu; > - struct nvmet_fc_fcp_iod fod[]; /* array of fcp_iods */ > + struct

Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-10-02 Thread Christoph Hellwig
On Tue, Sep 26, 2023 at 10:25:15PM +0100, Al Viro wrote: > Before your patch: foo_kill_super() calls kill_anon_super(), > which calls kill_super_notify(), which removes the sucker from > the list, then frees ->s_fs_info. After your patch: > removal from the lists happens via the call of

Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-09-26 Thread Christoph Hellwig
On Thu, Sep 14, 2023 at 06:38:43AM +0100, Al Viro wrote: > It's worse - look at the rationale for 2c18a63b760a "super: wait until > we passed kill super". Basically, "don't remove from the lists > until after block device closing". IOW, we have As of this stage we don't even touch anything

Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-09-26 Thread Christoph Hellwig
On Thu, Sep 14, 2023 at 12:27:12AM +0100, Al Viro wrote: > On Wed, Sep 13, 2023 at 08:09:57AM -0300, Christoph Hellwig wrote: > > Releasing an anon dev_t is a very common thing when freeing a > > super_block, as that's done for basically any not block based file > > syste

Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-09-26 Thread Christoph Hellwig
On Thu, Sep 14, 2023 at 09:56:57AM +0200, Christian Brauner wrote: > > BTW, this part of commit message in 2c18a63b760a is rather confused: > > Recent rework moved block device closing out of sb->put_super() and into > > sb->kill_sb() to avoid deadlocks as s_umount is held in put_super()

Re: [PATCH 01/19] fs: reflow deactivate_locked_super

2023-09-26 Thread Christoph Hellwig
On Wed, Sep 13, 2023 at 06:35:03PM +0200, Christian Brauner wrote: > I wouldn't mind s/s/sb/ here as well. So we stop using @s in some and > @sb in other places. I did that in an earlier version and decided to have some less churn. But I can add it back.

Re: [PATCH 10/19] USB: gadget/legacy: remove sb_mutex

2023-09-26 Thread Christoph Hellwig
On Wed, Sep 13, 2023 at 12:10:56PM -0400, Alan Stern wrote: > On Wed, Sep 13, 2023 at 08:10:04AM -0300, Christoph Hellwig wrote: > > Creating new a new super_block vs freeing the old one for single instance > > file systems is serialized by the wait for SB_DEAD. > > >