mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
driver core: Constify bin_attribute definitions
Mark all 'struct bin_attribute' instances as const to protect against accidental and malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241115-b4-sysfs-const-bin_attr-group-v1-2-2c9bb12dfc48@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
906c508afd
commit
5943c0dc79
@@ -45,7 +45,7 @@ static inline ssize_t cpumap_read(struct file *file, struct kobject *kobj,
|
||||
return n;
|
||||
}
|
||||
|
||||
static BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES);
|
||||
|
||||
static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
@@ -66,7 +66,7 @@ static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,
|
||||
return n;
|
||||
}
|
||||
|
||||
static BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
/**
|
||||
* struct node_access_nodes - Access class device to hold user visible
|
||||
@@ -578,7 +578,7 @@ static struct attribute *node_dev_attrs[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
static const struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
&bin_attr_cpumap,
|
||||
&bin_attr_cpulist,
|
||||
NULL
|
||||
@@ -586,7 +586,7 @@ static struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
|
||||
static const struct attribute_group node_dev_group = {
|
||||
.attrs = node_dev_attrs,
|
||||
.bin_attrs = node_dev_bin_attrs
|
||||
.bin_attrs_new = node_dev_bin_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *node_dev_groups[] = {
|
||||
|
||||
Reference in New Issue
Block a user