From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 4035B606A7BB for ; Tue, 3 Nov 2026 15:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Gp4zIMJh Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE55210F676; Tue, 3 Nov 2026 15:01:39 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D64810F657 for ; Tue, 3 Nov 2026 15:01:34 +0000 (UTC) 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: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 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