[PATCH] firmware: dmi: Mark bin_attributes as __ro_after_init

Thomas Weißschuh posted 1 patch 1 year, 2 months ago
drivers/firmware/dmi_scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] firmware: dmi: Mark bin_attributes as __ro_after_init
Posted by Thomas Weißschuh 1 year, 2 months ago
The attributes are only modified during the __init phase.
Protect them against accidental or intentional modifications afterwards.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/firmware/dmi_scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index fde0656481cc9577b05b781b703a8071e8d3fc4e..70d39adf50dcaaa7c99b48fe8e9045af5ea24d00 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -761,8 +761,8 @@ static void __init dmi_scan_machine(void)
 	pr_info("DMI not present or invalid.\n");
 }
 
-static BIN_ATTR_SIMPLE_ADMIN_RO(smbios_entry_point);
-static BIN_ATTR_SIMPLE_ADMIN_RO(DMI);
+static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(smbios_entry_point);
+static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(DMI);
 
 static int __init dmi_init(void)
 {

---
base-commit: 28eb75e178d389d325f1666e422bc13bbbb9804c
change-id: 20241122-sysfs-const-bin_attr-dmi-40c387a93dda

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>