Skip to content

Commit 0f049da

Browse files
t-8chgroeck
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-hwmon-v1-1-ea72a6a46c36@weissschuh.net Signed-off-by: Guenter Roeck <[email protected]>
1 parent cf85760 commit 0f049da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/occ/p9_sbe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct p9_sbe_occ {
3030
#define to_p9_sbe_occ(x) container_of((x), struct p9_sbe_occ, occ)
3131

3232
static ssize_t ffdc_read(struct file *filp, struct kobject *kobj,
33-
struct bin_attribute *battr, char *buf, loff_t pos,
33+
const struct bin_attribute *battr, char *buf, loff_t pos,
3434
size_t count)
3535
{
3636
ssize_t rc = 0;
@@ -48,7 +48,7 @@ static ssize_t ffdc_read(struct file *filp, struct kobject *kobj,
4848

4949
return rc;
5050
}
51-
static BIN_ATTR_RO(ffdc, OCC_MAX_RESP_WORDS * 4);
51+
static const BIN_ATTR_RO(ffdc, OCC_MAX_RESP_WORDS * 4);
5252

5353
static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,
5454
size_t resp_len)

0 commit comments

Comments
 (0)