summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-12-02 20:38:35 +0100
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-12-17 13:12:57 +0200
commit7ff2fecc8bc2e855bd17bd75358973c6bb4accbd (patch)
treec85013e79973300d7e820d72f58335c4460be4e3 /drivers/platform/x86/intel
parentb0034f206f140ecdd78e8f5fe4d61fb367124f3b (diff)
downloadlinux-7ff2fecc8bc2e855bd17bd75358973c6bb4accbd.tar.gz
linux-7ff2fecc8bc2e855bd17bd75358973c6bb4accbd.tar.bz2
linux-7ff2fecc8bc2e855bd17bd75358973c6bb4accbd.zip
platform/x86/intel/pmt: 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/20241202-sysfs-const-bin_attr-pdx86-v1-4-9ab204c2a814@weissschuh.net Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/intel')
-rw-r--r--drivers/platform/x86/intel/pmt/class.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
index 8ed54b7a3333..7233b654bbad 100644
--- a/drivers/platform/x86/intel/pmt/class.c
+++ b/drivers/platform/x86/intel/pmt/class.c
@@ -81,7 +81,7 @@ EXPORT_SYMBOL_NS_GPL(pmt_telem_read_mmio, "INTEL_PMT");
*/
static ssize_t
intel_pmt_read(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf, loff_t off,
+ const struct bin_attribute *attr, char *buf, loff_t off,
size_t count)
{
struct intel_pmt_entry *entry = container_of(attr,
@@ -308,7 +308,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
entry->pmt_bin_attr.attr.name = ns->name;
entry->pmt_bin_attr.attr.mode = 0440;
entry->pmt_bin_attr.mmap = intel_pmt_mmap;
- entry->pmt_bin_attr.read = intel_pmt_read;
+ entry->pmt_bin_attr.read_new = intel_pmt_read;
entry->pmt_bin_attr.size = entry->size;
ret = sysfs_create_bin_file(&dev->kobj, &entry->pmt_bin_attr);