Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: pch_phub: 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/20241221-sysfs-const-bin_attr-misc-drivers-v2-6-ba5e79fe8771@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
e588522d fc58d178

+4 -4
+4 -4
drivers/misc/pch_phub.c
··· 483 483 } 484 484 485 485 static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj, 486 - struct bin_attribute *attr, char *buf, 486 + const struct bin_attribute *attr, char *buf, 487 487 loff_t off, size_t count) 488 488 { 489 489 unsigned int rom_signature; ··· 553 553 } 554 554 555 555 static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj, 556 - struct bin_attribute *attr, 556 + const struct bin_attribute *attr, 557 557 char *buf, loff_t off, size_t count) 558 558 { 559 559 int err; ··· 655 655 .mode = S_IRUGO | S_IWUSR, 656 656 }, 657 657 .size = PCH_PHUB_OROM_SIZE + 1, 658 - .read = pch_phub_bin_read, 659 - .write = pch_phub_bin_write, 658 + .read_new = pch_phub_bin_read, 659 + .write_new = pch_phub_bin_write, 660 660 }; 661 661 662 662 static int pch_phub_probe(struct pci_dev *pdev,