Skip to content

Commit af58c75

Browse files
t-8chmartinkpetersen
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-5-f0a5e54b3437@weissschuh.net Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 61e2d41 commit af58c75

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
@@ -3639,7 +3639,7 @@ static DEVICE_ATTR(nr_scsi_channels, S_IRUGO | S_IWUSR,
36393639
* number of bytes printed to buffer
36403640
**/
36413641
static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
3642-
struct bin_attribute *bin_attr,
3642+
const struct bin_attribute *bin_attr,
36433643
char *buf, loff_t off, size_t count)
36443644
{
36453645
struct device *dev = kobj_to_dev(kobj);
@@ -3662,13 +3662,13 @@ static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
36623662
return count;
36633663
}
36643664

3665-
static struct bin_attribute ibmvfc_trace_attr = {
3665+
static const struct bin_attribute ibmvfc_trace_attr = {
36663666
.attr = {
36673667
.name = "trace",
36683668
.mode = S_IRUGO,
36693669
},
36703670
.size = 0,
3671-
.read = ibmvfc_read_trace,
3671+
.read_new = ibmvfc_read_trace,
36723672
};
36733673
#endif
36743674

0 commit comments

Comments
 (0)