From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67F9720E31A; Fri, 10 Jan 2025 14:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736517770; cv=none; b=tJUwmB059zBahWJPkrV6zXn/nzHDAhtK1LyafDLYjTgRzRc7crZ1j48aLkEXD8+14tGvTUwbll5S/pbH93JpqfF9Ez1/oQgS0kwhWjDjswYNJj4M7wrpwSnjQgW+5xCoE08QvmY61ej2ROsQ8pvM+M7a9OL+cueZvKcQFZqFoH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736517770; c=relaxed/simple; bh=PiHOuTmg4zVKpJegF6ABeMDuMTjgr4kkSmGq4TpISGQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V7ZTKsesnPf+87V/TP/y/MMeWc1alOv27L3K4NhjvhBQ4VWm3hPRI74n2MBE3qFIFlC9THWdAiMqJ0s5QFt/McsJFjGhcjW1ahxDrnmI5p1ABwxLlrw+Yk2D/ZQ9/ScWLas9TZs9bkMi0yCw9nY66+fZC3766l907Q1/uulPyRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1UgEq73O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1UgEq73O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59F6AC4CED6; Fri, 10 Jan 2025 14:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736517770; bh=PiHOuTmg4zVKpJegF6ABeMDuMTjgr4kkSmGq4TpISGQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1UgEq73O4FHpe2ME6QHxe7teMM6bDpyu8MXMdN9O8AaLkv60GwON/KHpjZUgYVvmR Ry1Dhq+iyNhko0bi34d1pq+B+TjcxHfguJ0Ye49THfp7BuRgEtJt5K+Ap9BrbOlPnI aeoCFckJv7amvcq7csX9bujUVnd56/4c9I2Y0wo8= Date: Fri, 10 Jan 2025 15:02:46 +0100 From: Greg Kroah-Hartman To: Christoph Hellwig Cc: Alexei Starovoitov , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , "Rafael J. Wysocki" , Luis Chamberlain , Petr Pavlu , Sami Tolvanen , Daniel Gomez , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , ppc-dev , LKML , linux-modules@vger.kernel.org, bpf Subject: Re: [PATCH v2 0/3] sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read() Message-ID: <2025011017-tubeless-hanky-0e99@gregkh> References: <20241228-sysfs-const-bin_attr-simple-v2-0-7c6f3f1767a3@weissschuh.net> <0cbfd352-ee3b-4670-afae-8e56d888e8c3@t-8ch.de> <2025010914-gangly-trodden-aa96@gregkh> <2025010930-resurrect-attest-94c9@gregkh> Precedence: bulk X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jan 09, 2025 at 12:23:01AM -0800, Christoph Hellwig wrote: > On Thu, Jan 09, 2025 at 09:12:03AM +0100, Greg Kroah-Hartman wrote: > > > Hey, when I duplicated the method to convert sysfs over to a proper > > > seq_file based approach that avoids buffer overflows you basically > > > came up with the same line that Alexei had here. > > > > I did? Sorry about that, I don't remember that. > > It's been a while.. > > > As for seq_file for sysfs, is that for binary attributes only, or for > > all? I can't recall that at all. > > Non-binary ones. Ah, yeah, well the churn for "one single value" sysfs files would be rough and seq_file doesn't really do much, if anything, for them as they should be all simple strings that never overflow or are complex. Yes, there are exceptions, so maybe for just them? I don't want to make it easier to abuse sysfs files, but if you feel it would really help out, I'm willing to reconsider it. thanks, greg k-h >