From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE0F606D537 for ; Thu, 5 Nov 2026 19:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=nFX+SoI0; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JxUDwRLS DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Cc:To:Subject: From:Message-ID:MIME-Version:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=1MugNV8TCf3DcwhciMioHkCDdfBEvJqmJegZE7T3Anc=; b=nFX+SoI0C3sNO6fFzGkTKk4qVQ 5i1fV3qf6ks+d2Kyx3EbTr92ujPLfdCHdVgTmoczPZkaaKoXQmSdcSWEFRhcijkZBjcWo+xMo+9JX wcOB6bNmklYePhQe5dNfoTHQ91rElgLMoKICTU6s1V8jpH+RFYpm3t0mcXNcW4/hN8pADf8RcsJaL tZnYifBUFoSSiScadZIINEfS83qYGwBuaZOM4Mws3V2dckS1UoPO+IHz48fy9rVr/bVztE40nYPxA AimbHW1lYPXNI8HRP4JUlxjti6st41FYrcVJvt1zly0gB0MqcnA1c6l+UydQ6t+q36g20BcxqH1r3 owtuOgEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xP3Gj-0000000ANWJ-37nz; Thu, 05 Nov 2026 19:37:05 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xP3FU-0000000AN2d-1zBd for kexec@lists.infradead.org; Thu, 05 Nov 2026 19:35:48 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 3BFE843CC2; Thu, 5 Nov 2026 19:35:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B6371F0089E; Thu, 5 Nov 2026 19:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793907348; bh=1MugNV8TCf3DcwhciMioHkCDdfBEvJqmJegZE7T3Anc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JxUDwRLS659AKy9L6EF/sMAUNJPV9IWLdEGgYT37J3Q3xoM9Rgl+/f5tJog9D28GT YMaZHCMQxAz8Q/YhL7D2HkKgLdWMS13ODeIvOVS2cO3Xyt1UiWgXthVq8iKNCfiwYC CBZKMuWNvUYO3GRSHNobx37W6/E4wT6vFZKwM2U+b9rd+Q0o+xU/Q/0vCpfhxieJT7 F6OAqSTAk8K2MFcN+drjgRiXeceRcYXDu/MhOHTrRoTOf/Jcy6qlsQJs6CLNabmhUG q0HrKvIx+/XHSn3ssmSRL1+tCAkBs5GI7/FQwPFk1on24fvEEyzBWmsp3oEib+CbCf nnIC8BG7tI46Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RESEND v2 16/23] proc: let procfs copy out reads that don't go through seq_file To: "Christian Brauner" Cc: "Linus Torvalds" , "Jann Horn" , "Josef Bacik" , "Chris Mason" , "Jeff Layton" , NeilBrown , "Eric Dumazet" , "Thomas Gleixner" , "Al Viro" , "Jonathan Corbet" , "Christoph Hellwig" , "Greg Kroah-Hartman" , "Joel Granados" , "Kees Cook" , "Jan Kara" , "Jan Kara" , linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-serial@vger.kernel.org, "Takashi Iwai" , linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, "Chuck Lever" , tytso@mit.edu, dmitry.torokhov@gmail.com, "Petr Pavlu" , "Anna Schumaker" , yukuai@fygo.io, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261104-work-procfs-core-v2-16-76ace653a773@kernel.org> References: <20261104-work-procfs-core-v2-0-76ace653a773@kernel.org> <20261104-work-procfs-core-v2-16-76ace653a773@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 05 Nov 2026 19:35:45 +0000 X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "kexec" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] proc: define and initialize __free(kvfree) variable buf in pde_read= _buf() -- commit 19cf278eb9fee57b90ee19764f6b076d9cab553d Author: Christian Brauner proc: let procfs copy out reads that don't go through seq_file This commit adds ->proc_read_buf() and PROC_ENTRY_FULL_READS to proc_ops so that non-seq_file procfs entries can fill a kernel buffer while pinned and let procfs copy it to userspace after unpinning the entry. > diff --git a/fs/proc/inode.c b/fs/proc/inode.c > index df1caa0f238df..caa47933c233d 100644 > --- a/fs/proc/inode.c > +++ b/fs/proc/inode.c [ ... ] > @@ -377,11 +379,67 @@ static loff_t proc_reg_llseek(struct file *file, lo= ff_t offset, int whence) > return rv; > } > =20 > +/* > + * The entry fills a kernel buffer and procfs copies that to userspace a= fter > + * unpinning the entry. A reader that faults on its buffer then doesn't = hold > + * up remove_proc_entry(). > + */ > +static ssize_t pde_read_buf(struct proc_dir_entry *pde, struct kiocb *io= cb, > + struct iov_iter *iter) > +{ > + struct file *file =3D iocb->ki_filp; > + char *buf __free(kvfree) =3D NULL; > + ssize_t rv, done =3D 0; > + size_t len, count; > + loff_t pos; > + > + if (!iov_iter_count(iter)) > + return 0; > + /* neither the allocation nor the entry can honor IOCB_NOWAIT */ > + if ((iocb->ki_flags & IOCB_NOWAIT) && !(file->f_flags & O_NONBLOCK)) > + return -EAGAIN; > + len =3D min_t(size_t, iov_iter_count(iter), pde->read_size); > + buf =3D kvmalloc(len, GFP_KERNEL); [Severity: Low] As reported by Sashiko on RFC [1], this isn't a bug, but in pde_read_buf() in fs/proc/inode.c, buf is declared with __free(kvfree) =3D NULL at the top of the function before the early returns and then assigned later at the kvmalloc() call. Could buf be defined and initialized in a single statement at the allocation site: char *buf __free(kvfree) =3D kvmalloc(len, GFP_KERNEL); to follow the cleanup.h conventions? [1] https://lore.kernel.org/r/sashiko-outbox-195540@kernel.org --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261104-work-procf= s-core-v2-0-76ace653a773@kernel.org?part=3D16