Article View: linux.kernel.netdev
Article #9743[PATCH RFC 09/22] sh: alignment: let procfs copy in writes
From: Christian Brauner
Date: Mon, 02 Nov 2026 15:01
Date: Mon, 02 Nov 2026 15:01
43 lines
10691 bytes
10691 bytes
Implement ->proc_write_buf() so procfs copies in what is written to the
alignment files before it pins the entry, and take the mode from that
copy. Writes larger than PAGE_SIZE - 1 bytes fail with -EINVAL now.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
arch/sh/mm/alignment.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c
index 2198c6f2ea63..d832249a8e18 100644
--- a/arch/sh/mm/alignment.c
+++ b/arch/sh/mm/alignment.c
@@ -133,14 +133,13 @@ static int alignment_proc_show(struct seq_file *m, void *v)
}
static ssize_t alignment_proc_write(struct file *file,
- const char __user *buffer, size_t count, loff_t *pos)
+ char *buffer, size_t count, loff_t *pos)
{
int *data = pde_data(file_inode(file));
char mode;
if (count > 0) {
- if (get_user(mode, buffer))
- return -EFAULT;
+ mode = buffer[0];
if (mode >= '0' && mode <= '5')
*data = mode - '0';
}
@@ -149,7 +148,7 @@ static ssize_t alignment_proc_write(struct file *file,
static const struct proc_ops alignment_proc_ops = {
.proc_show = alignment_proc_show,
- .proc_write = alignment_proc_write,
+ .proc_write_buf = alignment_proc_write,
};
/*
--
2.53.0
Technical Details
Message-ID:
<20261102-work-procfs-arch-v1-9-c9492ab08480@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354810-linux-kernel-netdev=dewy.ruReferences:
<20261102-work-procfs-arch-v1-0-c9492ab08480@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354810-linux-kernel-netdev=dewy.ru From: brauner@kernel.org (Christian Brauner) Newsgroups: linux.kernel.netdev Subject: [PATCH RFC 09/22] sh: alignment: let procfs copy in writes Date: Mon, 02 Nov 2026 16:01:36 +0100 Organization: Usenet Network Message-ID: <20261102-work-procfs-arch-v1-9-c9492ab08480@kernel.org> References: <20261102-work-procfs-arch-v1-0-c9492ab08480@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2964619"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Xabbtza5Le2ezvDZyKFybWkGv5w= sha256:f1CgMUytSm1wDrxbtYPhAqKkrHA7snx1DXOrji1ItXY= sha1:Cw4iUP4MG7G2U2Ot7qg59lhAt+w= sha256:HcCj5uXIrO3Je7QicKVpws2sLTSK5mb94G2RuvoroFo= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2F349112583; Mon, 2 Nov 2026 19:12:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vyYJpiBKdw_y; Mon, 2 Nov 2026 19:12:37 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354810-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 8E739112582; Mon, 2 Nov 2026 19:12:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 89C574442D; Mon, 2 Nov 2026 15:28:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793631896; b=ePOqxWUglsZejwcQRfEoEsoxhsgAtNKehhJOrHqEWEHzhY3Zt+m1n8FQViqive2+v1wv kr9Sux4IS6pRWczO8aDKCvZ5wQ9lnKgjEjY50QN0Xub8KZikmNyVVAq/x8J698EFoabh2 1Q6WX1oGqq6ul/JZC5cFJA4XtxEQzfckiIrua9L0LK6o87LqaIFYz5Yup7Ea1r3Hrux84 9ZEdXH9y/EYeK5L6h/i+1P4ZNNhJuMP+cyxgqAj3BECyjPzz6C0bNVhdn5GAV8AnrosN4 gvuntu0DsNiqrSLbd2wIAmsUCuW2EqeHgHU4eI8rUDBgaL3Xw8/I87+gIHKT7vdQquw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793631896; h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=moTp49XZfW2IxIkO6/t4/a2jJtvDF10yNUa6q6hnE3E=; b=fiYA2wNFPdBD/KQIywF4CKQ9MLp7Tf3CK2Y0H/Z3eCdv6gTXL/QqqdcYIbXjYVUadWxd AJQyLjuY70BqSRHSd6c3Z3QCv9MPr1/J/fXBK5Nd3JrjnWWCw+bSReq7NXNkBTCy+Rwih QTYNkzAHd+xGHWvtQrxj9I0JZn47Oz6+hRXgCe67tEhlC8lLl236iCMW9tZrSKxSfnGcU na5QzKLEiGpyDAIgkLovEeSp/EAA7RGf+aB4BBhR2H9mrVVUeYk6CAH95LsrB2yxVN4dK vGG1p2MDJS4mePhjApYF4iG2QlehllcDQdZRhSHCbA3kxdOAM1Tp2lGlUH9OwypjVcw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IiiIdQDE; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D4E860716FC; Mon, 2 Nov 2026 15:04:56 +0000 (UTC) X-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=IiiIdQDE X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793631880; b=Ndbqe+38B497pyLmehcVhMY/NcQKSIgh4xSpu18qUzsn2Q6KShWIxzQoEP3hWFw4FWwL rUximyxAcb+5KBky7QdQXCZVvaatDwImw0RFV0/aTQ4treq3dlCXJbC3Am/WBD9gloWlo YQ4bSW6Nem/DwiAq5y6XI0NV6uQ2WOnl3gqhmONSoKSGJIy2jJ9usaS3VaHu7/AQxynWG 7T22+CuUcnN4NGI3KyJgz5xFQTRlJucVSaYnp6gJyz7MvCM2xDfOEAjfjlLSzotlMHY3n RblfqrUVuhPpycxYpi8VPiG5dZarCE79tTjRFmjNUCKotmKggSjIuaclFgZgwVa+Pkg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793631880; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=moTp49XZfW2IxIkO6/t4/a2jJtvDF10yNUa6q6hnE3E=; b=Z4BL/wNiGb8QQKtF1hjJNDyfrFsx1CY8rlHPXGQebvTS8WAeWlzO53Akjy0LYWY2bLVf 9DcedJumRgBOLu9waa3is4CevYnnHpVuTnhKq3VwMhyzubHfF1KdUKlFHYr3uV997M4MS 5ac5W7UmvtQjeCAjiIDNai6AYneUFipkWBoQeNN9KPv0A9p5AfdiiurXxz+Usw9a5cKGA 5sWSOiOeoIz8LGklS3HaYbuGZ+HVP6P5BuM0nhlNjYyP3VoxEsdId6vXK+Uga2032dwiE TqFAPfyWPdLGUXYnfkt/KdfTIF/wfe9WXWtyd+ZQ9Jt/ehMyo6TfwOVP40XEqZycH6w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IiiIdQDE; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64A8F6085096; Mon, 2 Nov 2026 15:04:40 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 271441F00A1A; Mon, 2 Nov 2026 15:04:26 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793631880; bh=moTp49XZfW2IxIkO6/t4/a2jJtvDF10yNUa6q6hnE3E=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=IiiIdQDEZtu3zrQxqnMzxL+byWk/RAlCN8/hC422DxTxacxYbFQWlllhBgr+wCmCQ o9JOkaQkWd0AQIOfZ2O+qkAIOysyokSE2fcTak2VdOZoJKRHLA0f+7hXRqhPBAMdky vgWDoWlfqaLnAWRNoKk8RC6jFoyccCUDgzz/C6H/mIYktv6mCSN/TWi3bYAQ7NRiTd 5S25YeBcc3fgExVmao12q8Y5BebuiNbZn+zxcQiNl93jyDgvg9mLGIhUCHtUIS5ANV /YEQs36+1Zxizq9lsuD1fhZ94uGyuaO2p6IZK+qsp1AhT+1p7srUwebEMTN+HJIWDu Gdu23GXfY3v+w== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261102-work-procfs-arch-v1-0-c9492ab08480@kernel.org> X-Cc: Linus Torvalds <torvalds@linux-foundation.org>, Jann Horn <jannh@google.com>, Josef Bacik <josef@toxicpanda.com>, Chris Mason <mason@kernel.org>, Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>, Eric Dumazet <edumazet@kernel.org>, Thomas Gleixner <tglx@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>, Jonathan Corbet <corbet@lwn.net>, Christoph Hellwig <hch@lst.de>, Greg Kroah-Hartman <gregkh@suse.de>, Joel Granados <joel.granados@kernel.org>, Kees Cook <kees@kernel.org>, Jan Kara <jack@suse.cz>, Jan Kara <jack@suse.com>, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai <tiwai@suse.de>, linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" <brauner@kernel.org>, Chuck Lever <cel@kernel.org> X-Mailer: b4 0.17-dev