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 <li...@weissschuh.net> --- Changes in v2: - Fix NULL deref in c2port_bin_attr_size() (0day CI) - Add Ack for cxl/ocxl changes - Link to v1: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-misc-drivers-v1-0-d50ff7b21...@weissschuh.net --- Thomas Weißschuh (9): ocxl: Constify 'struct bin_attribute' cxl: Constify 'struct bin_attribute' misc: sram: constify 'struct bin_attribute' misc: c2port: Calculate bin_attribute size through group callback misc: c2port: Constify 'struct bin_attribute' misc: pch_phub: Constify 'struct bin_attribute' misc: eeprom/idt_89hpesx: Constify 'struct bin_attribute' misc: eeprom/max6875: Constify 'struct bin_attribute' misc: ds1682: Constify 'struct bin_attribute' drivers/misc/c2port/core.c | 29 ++++++++++++++++++++--------- drivers/misc/cxl/sysfs.c | 8 ++++---- drivers/misc/ds1682.c | 8 ++++---- drivers/misc/eeprom/idt_89hpesx.c | 6 +++--- drivers/misc/eeprom/max6875.c | 4 ++-- drivers/misc/ocxl/sysfs.c | 4 ++-- drivers/misc/pch_phub.c | 8 ++++---- drivers/misc/sram.c | 8 ++++---- 8 files changed, 43 insertions(+), 32 deletions(-) --- base-commit: 499551201b5f4fd3c0618a3e95e3d0d15ea18f31 change-id: 20241215-sysfs-const-bin_attr-misc-drivers-721114a2b3d3 Best regards, -- Thomas Weißschuh <li...@weissschuh.net>