Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] proc: unused-but-set variable p in seq_open_net() when CONFIG_NET_NS=n --
commit 4dea51dab83a49a4131e34ad5f96bc9822052389 Author: Christian Brauner <[email protected]> proc: let procfs own the seq_file of proc_create_seq() and friends This commit updates proc_create_seq_private(), proc_create_single_data(), and their network namespace variants so that procfs owns the seq_file directly via PROC_ENTRY_proc_seq_ops and PROC_ENTRY_proc_show. For the network namespace variants, ->proc_open() and ->proc_release() are simplified to only manage the network namespace reference. > diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c > index df5484813d5dd..9973f846c4674 100644 > --- a/fs/proc/proc_net.c > +++ b/fs/proc/proc_net.c > @@ -37,13 +37,13 @@ static struct net *get_proc_net(const struct inode *inode) > return maybe_get_net(PDE_NET(PDE(inode))); > } > > +/* procfs opened the seq_file and allocated its state, see pde_seq_start() */ > static int seq_open_net(struct inode *inode, struct file *file) > { > - unsigned int state_size = PDE(inode)->state_size; > - struct seq_net_private *p; > + struct seq_net_private *p = ((struct seq_file > *)file->private_data)->private; > struct net *net; > > - WARN_ON_ONCE(state_size < sizeof(*p)); > + WARN_ON_ONCE(PDE(inode)->state_size < sizeof(*p)); > > if (file->f_mode & FMODE_WRITE && !PDE(inode)->write) > return -EACCES; > @@ -51,12 +51,6 @@ static int seq_open_net(struct inode *inode, struct file > *file) > net = get_proc_net(inode); > if (!net) > return -ENXIO; > - > - p = __seq_open_private(file, PDE(inode)->seq_ops, state_size); > - if (!p) { > - put_net(net); > - return -ENOMEM; > - } > #ifdef CONFIG_NET_NS > p->net = net; > netns_tracker_alloc(net, &p->ns_tracker, GFP_KERNEL); [Severity: Low] When CONFIG_NET_NS is disabled, does initializing p unconditionally in seq_open_net() trigger a -Wunused-but-set-variable warning? Previously, p was assigned via __seq_open_private() and checked with if (!p) outside the #ifdef CONFIG_NET_NS block. With that check removed, the only remaining reference outside #ifdef CONFIG_NET_NS is sizeof(*p) in WARN_ON_ONCE(), which is an unevaluated context and does not read the value of p. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=8
