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

Configure Feed

Select the types of activity you want to include in your feed.

iio: imu: bno055: 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://patch.msgid.link/20241215-sysfs-const-bin_attr-iio-v1-1-a5801212482e@weissschuh.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Thomas Weißschuh and committed by
Jonathan Cameron
898918d6 9351bbb1

+4 -4
+4 -4
drivers/iio/imu/bno055/bno055.c
··· 1193 1193 } 1194 1194 1195 1195 static ssize_t calibration_data_read(struct file *filp, struct kobject *kobj, 1196 - struct bin_attribute *bin_attr, char *buf, 1196 + const struct bin_attribute *bin_attr, char *buf, 1197 1197 loff_t pos, size_t count) 1198 1198 { 1199 1199 struct bno055_priv *priv = iio_priv(dev_to_iio_dev(kobj_to_dev(kobj))); ··· 1348 1348 NULL 1349 1349 }; 1350 1350 1351 - static BIN_ATTR_RO(calibration_data, BNO055_CALDATA_LEN); 1351 + static const BIN_ATTR_RO(calibration_data, BNO055_CALDATA_LEN); 1352 1352 1353 - static struct bin_attribute *bno055_bin_attrs[] = { 1353 + static const struct bin_attribute *const bno055_bin_attrs[] = { 1354 1354 &bin_attr_calibration_data, 1355 1355 NULL 1356 1356 }; 1357 1357 1358 1358 static const struct attribute_group bno055_attrs_group = { 1359 1359 .attrs = bno055_attrs, 1360 - .bin_attrs = bno055_bin_attrs, 1360 + .bin_attrs_new = bno055_bin_attrs, 1361 1361 }; 1362 1362 1363 1363 static const struct iio_info bno055_info = {