summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-12-15 16:19:04 +0100
committerGuenter Roeck <linux@roeck-us.net>2024-12-15 22:02:26 -0800
commit0f049da5b0568cafd39706cc87a1b689dcdae8a0 (patch)
tree6daa418aea13e28f150df27000d8611d10e6c782
parentcf85760f6a0a656d06d9e2851fc82baf1240262a (diff)
hwmon: (occ/p9_sbe) 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 <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-hwmon-v1-1-ea72a6a46c36@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/occ/p9_sbe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
index 89761a9c8892..1e3749dfa598 100644
--- a/drivers/hwmon/occ/p9_sbe.c
+++ b/drivers/hwmon/occ/p9_sbe.c
@@ -30,7 +30,7 @@ struct p9_sbe_occ {
#define to_p9_sbe_occ(x) container_of((x), struct p9_sbe_occ, occ)
static ssize_t ffdc_read(struct file *filp, struct kobject *kobj,
- struct bin_attribute *battr, char *buf, loff_t pos,
+ const struct bin_attribute *battr, char *buf, loff_t pos,
size_t count)
{
ssize_t rc = 0;
@@ -48,7 +48,7 @@ static ssize_t ffdc_read(struct file *filp, struct kobject *kobj,
return rc;
}
-static BIN_ATTR_RO(ffdc, OCC_MAX_RESP_WORDS * 4);
+static const BIN_ATTR_RO(ffdc, OCC_MAX_RESP_WORDS * 4);
static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,
size_t resp_len)