Skip to content

Commit 3e72fc0

Browse files
t-8chmartinkpetersen
authored andcommitted
scsi: arcmsr: 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-3-f0a5e54b3437@weissschuh.net Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1cf448b commit 3e72fc0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/arcmsr/arcmsr_attr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp,
6262
struct kobject *kobj,
63-
struct bin_attribute *bin,
63+
const struct bin_attribute *bin,
6464
char *buf, loff_t off,
6565
size_t count)
6666
{
@@ -107,7 +107,7 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp,
107107

108108
static ssize_t arcmsr_sysfs_iop_message_write(struct file *filp,
109109
struct kobject *kobj,
110-
struct bin_attribute *bin,
110+
const struct bin_attribute *bin,
111111
char *buf, loff_t off,
112112
size_t count)
113113
{
@@ -155,7 +155,7 @@ static ssize_t arcmsr_sysfs_iop_message_write(struct file *filp,
155155

156156
static ssize_t arcmsr_sysfs_iop_message_clear(struct file *filp,
157157
struct kobject *kobj,
158-
struct bin_attribute *bin,
158+
const struct bin_attribute *bin,
159159
char *buf, loff_t off,
160160
size_t count)
161161
{
@@ -194,7 +194,7 @@ static const struct bin_attribute arcmsr_sysfs_message_read_attr = {
194194
.mode = S_IRUSR ,
195195
},
196196
.size = ARCMSR_API_DATA_BUFLEN,
197-
.read = arcmsr_sysfs_iop_message_read,
197+
.read_new = arcmsr_sysfs_iop_message_read,
198198
};
199199

200200
static const struct bin_attribute arcmsr_sysfs_message_write_attr = {
@@ -203,7 +203,7 @@ static const struct bin_attribute arcmsr_sysfs_message_write_attr = {
203203
.mode = S_IWUSR,
204204
},
205205
.size = ARCMSR_API_DATA_BUFLEN,
206-
.write = arcmsr_sysfs_iop_message_write,
206+
.write_new = arcmsr_sysfs_iop_message_write,
207207
};
208208

209209
static const struct bin_attribute arcmsr_sysfs_message_clear_attr = {
@@ -212,7 +212,7 @@ static const struct bin_attribute arcmsr_sysfs_message_clear_attr = {
212212
.mode = S_IWUSR,
213213
},
214214
.size = 1,
215-
.write = arcmsr_sysfs_iop_message_clear,
215+
.write_new = arcmsr_sysfs_iop_message_clear,
216216
};
217217

218218
int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb)

0 commit comments

Comments
 (0)