[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20241216-sysfs-const-bin_attr-scsi-v1-5-f0a5e54b3437@weissschuh.net>
Date: Mon, 16 Dec 2024 12:29:12 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Adam Radford <aradford@...il.com>,
Bradley Grove <linuxdrivers@...otech.com>,
Tyrel Datwyler <tyreld@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>, Madhavan Srinivasan <maddy@...ux.ibm.com>,
James Smart <james.smart@...adcom.com>,
Dick Kennedy <dick.kennedy@...adcom.com>, Brian King <brking@...ibm.com>,
Saurav Kashyap <skashyap@...vell.com>, Javed Hasan <jhasan@...vell.com>,
GR-QLogic-Storage-Upstream@...vell.com, Nilesh Javali <njavali@...vell.com>,
Manish Rangankar <mrangankar@...vell.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 05/11] scsi: ibmvfc: Constify 'struct bin_attribute'
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ßschuh <linux@...ssschuh.net>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index e66c3ef74267a5527b21e6e1d13efb91425b158e..dc8401587bb529860d261ac83b924fceac8335d9 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3639,7 +3639,7 @@ static DEVICE_ATTR(nr_scsi_channels, S_IRUGO | S_IWUSR,
* number of bytes printed to buffer
**/
static ssize_t ibmvfc_read_trace(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 device *dev = kobj_to_dev(kobj);
@@ -3662,13 +3662,13 @@ static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
return count;
}
-static struct bin_attribute ibmvfc_trace_attr = {
+static const struct bin_attribute ibmvfc_trace_attr = {
.attr = {
.name = "trace",
.mode = S_IRUGO,
},
.size = 0,
- .read = ibmvfc_read_trace,
+ .read_new = ibmvfc_read_trace,
};
#endif
--
2.47.1
Powered by blists - more mailing lists