From nobody Wed Dec 17 21:41:10 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 5922D1FCD0F for ; Sat, 21 Dec 2024 14:48:16 +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=1734792498; cv=none; b=JQU4n4VnOUyLX2HoT6gWjOP7UuohUc8So8GBXrk9XGeqfEy9enyUuvA7DyVhhi2W97DLH3yH4pOkaABCHE0JWXdvCVpp6yhNbaaj3XY5YYFEBKrXVqxiof0T5YR9N9Ai8S39qoB/Ui+UJa4j0iVWSfSDibFW8uX5FHru0WizPTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734792498; c=relaxed/simple; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bfa6vFiPjrTr84Dm+U/x1LRPLTia9RL0mwhQKr3ERVjodIpHGV+1ZHujgh1NNojA3quPsUbMy7oF7EUytALQy2AjudNhXmj9gRX0bBrPkSp7nNaGrszfCGnLcTV/OhK3OMBXi6VO4gjnqkzgC2/ie5a+lNAu8yGOZAx8KMg7g6w= 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=JNVcWW2g; 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="JNVcWW2g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1734792491; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JNVcWW2gFSmvicQCnJGojFONnzhcFAsQGpIKt6ReRKCCf+YKAnUgrh7vjeRAisGUm v30iei+YcDn+MZfccO4rxmoS++hnGiFThuz/x2TRXE7UHzOduKb7TdVX9PkfQS3vso lTMgneXPAepSWSzaIiCNTSuFL23RzMF9ctzWzffA= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 21 Dec 2024 15:48:14 +0100 Subject: [PATCH v2 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: <20241221-sysfs-const-bin_attr-misc-drivers-v2-8-ba5e79fe8771@weissschuh.net> References: <20241221-sysfs-const-bin_attr-misc-drivers-v2-0-ba5e79fe8771@weissschuh.net> In-Reply-To: <20241221-sysfs-const-bin_attr-misc-drivers-v2-0-ba5e79fe8771@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=1734792490; l=1212; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=P5yp8xYY8rjGfFuGyyUiA1DeB8eRe4QDxQgMbEH9sX4=; b=RXc6sdUDetNj/ZNOQ7p5ylGNWpmccRq2GRI6mGXONV+ZAdL005yVc1OM1q/GydoVP+FgaFH1y bll9rm0OAfvDlwN6xXOLVsWLG0SZrIssLygrIHOyS6BFhM5dXEfMukl 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