Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: eeprom/max6875: 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/20241221-sysfs-const-bin_attr-misc-drivers-v2-8-ba5e79fe8771@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
052bd11e 6a43faaa

+2 -2
+2 -2
drivers/misc/eeprom/max6875.c
··· 104 104 } 105 105 106 106 static ssize_t max6875_read(struct file *filp, struct kobject *kobj, 107 - struct bin_attribute *bin_attr, 107 + const struct bin_attribute *bin_attr, 108 108 char *buf, loff_t off, size_t count) 109 109 { 110 110 struct i2c_client *client = kobj_to_i2c_client(kobj); ··· 127 127 .mode = S_IRUGO, 128 128 }, 129 129 .size = USER_EEPROM_SIZE, 130 - .read = max6875_read, 130 + .read_new = max6875_read, 131 131 }; 132 132 133 133 static int max6875_probe(struct i2c_client *client)