mirror of
https://github.com/torvalds/linux.git
synced 2026-03-13 22:36:17 +01:00
firmware: qemu_fw_cfg: 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: Gabriel Somlo <somlo@cmu.edu> Acked-by: Michael S. Tsirkin <mst@redhat.com> Link: https://lore.kernel.org/r/20250114-sysfs-const-bin_attr-qemu_fw_cfg-v1-1-76f525a3ee72@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4aad348d0f
commit
80f756cabf
1 changed files with 3 additions and 3 deletions
|
|
@ -460,7 +460,7 @@ static const struct kobj_type fw_cfg_sysfs_entry_ktype = {
|
|||
|
||||
/* raw-read method and attribute */
|
||||
static ssize_t fw_cfg_sysfs_read_raw(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
const struct bin_attribute *bin_attr,
|
||||
char *buf, loff_t pos, size_t count)
|
||||
{
|
||||
struct fw_cfg_sysfs_entry *entry = to_entry(kobj);
|
||||
|
|
@ -474,9 +474,9 @@ static ssize_t fw_cfg_sysfs_read_raw(struct file *filp, struct kobject *kobj,
|
|||
return fw_cfg_read_blob(entry->select, buf, pos, count);
|
||||
}
|
||||
|
||||
static struct bin_attribute fw_cfg_sysfs_attr_raw = {
|
||||
static const struct bin_attribute fw_cfg_sysfs_attr_raw = {
|
||||
.attr = { .name = "raw", .mode = S_IRUSR },
|
||||
.read = fw_cfg_sysfs_read_raw,
|
||||
.read_new = fw_cfg_sysfs_read_raw,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue