Skip to content

Commit 7da14de

Browse files
t-8chTzung-Bi Shih
authored andcommitted
firmware: google: gsmi: 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]> Acked-by: Brian Norris <[email protected]> Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-google-v1-2-e5c2808f5833@weissschuh.net Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent bf2066c commit 7da14de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/firmware/google/gsmi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static const struct efivar_operations efivar_ops = {
488488
#endif /* CONFIG_EFI */
489489

490490
static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
491-
struct bin_attribute *bin_attr,
491+
const struct bin_attribute *bin_attr,
492492
char *buf, loff_t pos, size_t count)
493493
{
494494
struct gsmi_set_eventlog_param param = {
@@ -528,9 +528,9 @@ static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
528528

529529
}
530530

531-
static struct bin_attribute eventlog_bin_attr = {
531+
static const struct bin_attribute eventlog_bin_attr = {
532532
.attr = {.name = "append_to_eventlog", .mode = 0200},
533-
.write = eventlog_write,
533+
.write_new = eventlog_write,
534534
};
535535

536536
static ssize_t gsmi_clear_eventlog_store(struct kobject *kobj,

0 commit comments

Comments
 (0)