From nobody Wed Dec 17 21:40:56 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 EE55120550E for ; Mon, 16 Dec 2024 11:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734348788; cv=none; b=M63RlZytGAH1U4Bey6ZdzZ1cUIqxHQf+yPKWPgpyfBRZio2W+rkwD5gpTR9PejlBySKL7aVZigvAqlOrZYDfnBFBg/v5JRBVi8ZGKs5snc8vCRcODK20xD3oPg4Xmq/C5ViHwdRihBssffazHniUTi+hvtNHgGfk6UsuCP16mQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734348788; c=relaxed/simple; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P9G01z4VbiTDxiUhKgh9txXUQ/R+hKeB1pfo5qi2oDMf7qDAtT1pIZ2m0/yYdx7iIeGBWTb1NANGZqisUxrhdOXoA7sFiJTQp/4vMHgPAsLU1LljWuOl1/8CgJ8GTYGmgCkrxQosBz8Bpq3Fe8jWD0tQz4dVsZDRI8mHkI0kPAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=svVmtvaE; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="svVmtvaE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1734348782; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=svVmtvaEfVKWlI8VZwfYj66iHqRaO9PnQVSWrmsw4BujiyUQ+yko3HpWl4Dl1hkWB 5lkzEWLtizIAVIHU0EJsQ3SUY7mzGJTbzn38cGo4rpCCm/H6eD+4c/tweUanj8Stz1 u09BB8wsiP6LvSqot8lM67B0ywl2z3xoqRFkxljk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Dec 2024 12:33:03 +0100 Subject: [PATCH 8/9] misc: eeprom/max6875: Constify 'struct bin_attribute' Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241216-sysfs-const-bin_attr-misc-drivers-v1-8-d50ff7b21367@weissschuh.net> References: <20241216-sysfs-const-bin_attr-misc-drivers-v1-0-d50ff7b21367@weissschuh.net> In-Reply-To: <20241216-sysfs-const-bin_attr-misc-drivers-v1-0-d50ff7b21367@weissschuh.net> To: Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734348781; l=1212; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; b=k7/JQA7TzOn/tnIeXdQZ/clBNOPvkBekXegG3kZ5eiGbNYKtRRCJtibmbDT1eNMQHtuOt/QMq jszYpZRVM+iAkaXxT6+Rw3UkJHgxAHt3vZgEkhmIAc06ICDAljy8us1 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/misc/eeprom/max6875.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/eeprom/max6875.c b/drivers/misc/eeprom/max6875.c index 6fab2ffa736b741593931c413f230d7c43b5b8dd..1c36ad153e783ead6ba2481c648= 38390f0bb05f4 100644 --- a/drivers/misc/eeprom/max6875.c +++ b/drivers/misc/eeprom/max6875.c @@ -104,7 +104,7 @@ static void max6875_update_slice(struct i2c_client *cli= ent, int slice) } =20 static ssize_t max6875_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, + const struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct i2c_client *client =3D kobj_to_i2c_client(kobj); @@ -127,7 +127,7 @@ static const struct bin_attribute user_eeprom_attr =3D { .mode =3D S_IRUGO, }, .size =3D USER_EEPROM_SIZE, - .read =3D max6875_read, + .read_new =3D max6875_read, }; =20 static int max6875_probe(struct i2c_client *client) --=20 2.47.1