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 B9F5960A6F6F for ; Tue, 3 Nov 2026 15:01:37 +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=ORgevS0I; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Gp4zIMJh 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=r9QXWEwcwVsmD+gtjv1V0GbX1OqeCi9C0moHpPKkhRQ=; b=ORgevS0Id5+Yg7mfKFZ8QM0bzV iFS0zD26W9NuWK8afS5S2LNkuIfvtAankRzkVb5DopP2T5sggR+63MJOHxsyLXlJIV+LPIkcC95mJ NY+5er68pXhwGqbdzJa1jBtnwnGuaqAq5PuoXbEigvQE9YvVAamME0bg2rttgK//iKptwmmVODGK/ aFR5FDYlhNAbKmt+jcm5fnZZrcdX6C9z9Sik6fZFO1T9PlT1bYZD7013emLtEqxw3ylLO00v71JW6 cJEzRh8jKC5xDGaWRY83pTKZVyQ8CAq5xDQtE6K0ESip2wHPF2QGBa1ixnVPNUG2YvzIK66ZC1WvY MmhF+zoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOG13-00000002ptc-1iTT; Tue, 03 Nov 2026 15:01:37 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOG10-00000002pqW-0LvP for kexec@lists.infradead.org; Tue, 03 Nov 2026 15:01:34 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D15C9402E8; Tue, 3 Nov 2026 15:01:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12F351F00A17; Tue, 3 Nov 2026 15:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793718093; bh=r9QXWEwcwVsmD+gtjv1V0GbX1OqeCi9C0moHpPKkhRQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Gp4zIMJhOwNqzm61c0h9XNd9e0AwMrFelEXQHKRAAlQ2LDeEpeF5m7tBEoFMtPFtY uS4RsfPUfBZ2hRlArgVukP7X27SDUoJHgd88tPlb4o1OnQzVSaWgr3kNiGA9hxIq/E 7mb+cQIMUcKjUtjkRzdgBHMuNsu5EauysVoMaNwzoPfPD0sP32Kk9v3DT6vIUEgTNp cOzOKQMESWOupzjY/ff38B2v3OsIMhrG6ZdWGYcCgTBgg6ho7OLcY+ImD//T211CBM 0ZuQsQcQMsjbrmcE+Eu/aRaJ5b+O1TMZX8eMsi4Ysf8/HRob1Y5+l5qFso1ia6iabK z49HG1oD9fXRg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC 13/16] 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: <20261102-work-procfs-core-v1-13-75df35e4f8b8@kernel.org> References: <20261102-work-procfs-core-v1-0-75df35e4f8b8@kernel.org> <20261102-work-procfs-core-v1-13-75df35e4f8b8@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 03 Nov 2026 15:01:30 +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=ham 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 one stat= ement in pde_read_buf() -- commit f2c1eb05c1e48ef170c932c3f77db0e09db3d058 Author: Christian Brauner proc: let procfs copy out reads that don't go through seq_file This commit adds a proc_read_buf callback to struct proc_ops so procfs entries can fill a kernel buffer while pinned and let procfs copy the buffer to userspace after unpinning the entry. > diff --git a/fs/proc/inode.c b/fs/proc/inode.c > index c0bb40e7ff964..3f29a1663d266 100644 > --- a/fs/proc/inode.c > +++ b/fs/proc/inode.c [ ... ] > @@ -400,11 +402,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] This isn't a bug, but in pde_read_buf(), buf is declared with __free(kvfree) =3D NULL at the top of the function before the early return checks for !iov_iter_count(iter) and IOCB_NOWAIT, and then assigned separately via kvmalloc(). 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? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261102-work-procf= s-core-v1-0-75df35e4f8b8@kernel.org?part=3D13