mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 18:42:14 -04:00
powerpc/powernv/ultravisor: 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/20241216-sysfs-const-bin_attr-powerpc-v1-3-bbed8906f476@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
982d13db10
commit
f629576662
@@ -32,15 +32,15 @@ int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
|
||||
static struct memcons *uv_memcons;
|
||||
|
||||
static ssize_t uv_msglog_read(struct file *file, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr, char *to,
|
||||
const struct bin_attribute *bin_attr, char *to,
|
||||
loff_t pos, size_t count)
|
||||
{
|
||||
return memcons_copy(uv_memcons, to, pos, count);
|
||||
}
|
||||
|
||||
static struct bin_attribute uv_msglog_attr = {
|
||||
static struct bin_attribute uv_msglog_attr __ro_after_init = {
|
||||
.attr = {.name = "msglog", .mode = 0400},
|
||||
.read = uv_msglog_read
|
||||
.read_new = uv_msglog_read
|
||||
};
|
||||
|
||||
static int __init uv_init(void)
|
||||
|
||||
Reference in New Issue
Block a user