Skip to content

Commit e2b4e82

Browse files
committed
scsi: ibmvfc: Constify 'struct bin_attribute'
JIRA: https://issues.redhat.com/browse/RHEL-116876 commit af58c75 Author: Thomas Weißschuh <linux@weissschuh.net> Date: Mon Dec 16 12:29:12 2024 +0100 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@weissschuh.net> Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-5-f0a5e54b3437@weissschuh.net Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
1 parent 389cf67 commit e2b4e82

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,7 +3641,7 @@ static DEVICE_ATTR(nr_scsi_channels, S_IRUGO | S_IWUSR,
36413641
* number of bytes printed to buffer
36423642
**/
36433643
static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
3644-
struct bin_attribute *bin_attr,
3644+
const struct bin_attribute *bin_attr,
36453645
char *buf, loff_t off, size_t count)
36463646
{
36473647
struct device *dev = kobj_to_dev(kobj);
@@ -3664,13 +3664,13 @@ static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
36643664
return count;
36653665
}
36663666

3667-
static struct bin_attribute ibmvfc_trace_attr = {
3667+
static const struct bin_attribute ibmvfc_trace_attr = {
36683668
.attr = {
36693669
.name = "trace",
36703670
.mode = S_IRUGO,
36713671
},
36723672
.size = 0,
3673-
.read = ibmvfc_read_trace,
3673+
.read_new = ibmvfc_read_trace,
36743674
};
36753675
#endif
36763676

0 commit comments

Comments
 (0)