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 3CB1A1FCCFD 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=1734792497; cv=none; b=gQM5D7FXOrmtRJxGe9OdmcfNO2m9oaJnndbPXAuVInHcz2geLxyK6Uivhddr8tjTBSPNtLubeaqUDaUAygh3y3KcbyCHuLG7k+AzZWGcduFSLYTqvEWGfZSAZ+RpI/3gVlVBpfefG2I/PjU3bMCKwyUYVjGbkkdnMlaPxPeoQ5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734792497; c=relaxed/simple; bh=SGNU5IH45oWd8l2/U8DWBMgp52g/CAQH5eqzkYxnU98=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rgnsdCB2hlHRBueZKKAD0eTzPeCHcA1MnN1//mvXSI98fYDmJOfLy6QOc3YqoDBlNZ5sduZ2Vd5VRTteI/pQd3b/EBWii0MShWlR0mLLKYVSNPOZSiiEXU5nI/Rwld/x3CHKM9OOGruW43/JMFjYQNX0JHvomd4E3e76NkuHFzw= 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=BYWrCwnE; 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="BYWrCwnE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1734792491; bh=SGNU5IH45oWd8l2/U8DWBMgp52g/CAQH5eqzkYxnU98=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BYWrCwnEkn0QHxatyy8rZTjh4Iq0endZnyBkLvR4dJY+RPmT+pSThMIA1VQGAenM/ 7CS3e3STgGwan9cQT9P4oaqoN2vSXl/xZ3ik5i3X5oMIyRpT1wcgJxYgEEwoU/KAqY Ct0A+8BrBH8ROREFUysqC6o9TIh24e2OaWWF9tdU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 21 Dec 2024 15:48:13 +0100 Subject: [PATCH v2 7/9] misc: eeprom/idt_89hpesx: 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-7-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=1790; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=SGNU5IH45oWd8l2/U8DWBMgp52g/CAQH5eqzkYxnU98=; b=QNNWabCGxYdXGIaopmxDFnMFSHHSbTjQvdcOUBaTQYvRsIoPHmXFwwCwl2o+0S2E1qKiWVKVD B9JJWLcfMQICjSaIrvp4H0cDOrl3beHSgRgZ1W6PewNC25s/IpIV8dt 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/idt_89hpesx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89= hpesx.c index 43421fe37d338874ff1c2949497c64ebf0143106..1fc632ebf22f560088084519e5a= d8e8b37958368 100644 --- a/drivers/misc/eeprom/idt_89hpesx.c +++ b/drivers/misc/eeprom/idt_89hpesx.c @@ -847,7 +847,7 @@ static int idt_csr_read(struct idt_89hpesx_dev *pdev, u= 16 csraddr, u32 *data) * @count: Number of bytes to write */ static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, + const struct bin_attribute *attr, char *buf, loff_t off, size_t count) { struct idt_89hpesx_dev *pdev; @@ -871,7 +871,7 @@ static ssize_t eeprom_write(struct file *filp, struct k= object *kobj, * @count: Number of bytes to write */ static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, + const struct bin_attribute *attr, char *buf, loff_t off, size_t count) { struct idt_89hpesx_dev *pdev; @@ -1017,7 +1017,7 @@ static ssize_t idt_dbgfs_csr_read(struct file *filep,= char __user *ubuf, * NOTE Size will be changed in compliance with OF node. EEPROM attribute = will * be read-only as well if the corresponding flag is specified in OF node. */ -static BIN_ATTR_RW(eeprom, EEPROM_DEF_SIZE); +static const BIN_ATTR_RW(eeprom, EEPROM_DEF_SIZE); =20 /* * csr_dbgfs_ops - CSR debugfs-node read/write operations --=20 2.47.1