Skip to content

Commit 389cf67

Browse files
committed
ocxl: Constify 'struct bin_attribute'
JIRA: https://issues.redhat.com/browse/RHEL-116876 commit 0e3cd21 Author: Thomas Weißschuh <linux@weissschuh.net> Date: Sat Dec 21 15:48:07 2024 +0100 ocxl: 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> Acked-by: Andrew Donnellan <ajd@linux.ibm.com> Link: https://lore.kernel.org/r/20241221-sysfs-const-bin_attr-misc-drivers-v2-1-ba5e79fe8771@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
1 parent fbb2646 commit 389cf67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/misc/ocxl/sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static struct device_attribute afu_attrs[] = {
9494
};
9595

9696
static ssize_t global_mmio_read(struct file *filp, struct kobject *kobj,
97-
struct bin_attribute *bin_attr, char *buf,
97+
const struct bin_attribute *bin_attr, char *buf,
9898
loff_t off, size_t count)
9999
{
100100
struct ocxl_afu *afu = to_afu(kobj_to_dev(kobj));
@@ -155,7 +155,7 @@ int ocxl_sysfs_register_afu(struct ocxl_file_info *info)
155155
info->attr_global_mmio.attr.name = "global_mmio_area";
156156
info->attr_global_mmio.attr.mode = 0600;
157157
info->attr_global_mmio.size = info->afu->config.global_mmio_size;
158-
info->attr_global_mmio.read = global_mmio_read;
158+
info->attr_global_mmio.read_new = global_mmio_read;
159159
info->attr_global_mmio.mmap = global_mmio_mmap;
160160
rc = device_create_bin_file(&info->dev, &info->attr_global_mmio);
161161
if (rc) {

0 commit comments

Comments
 (0)