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

Configure Feed

Select the types of activity you want to include in your feed.

btf: Switch module BTF attribute to sysfs_bin_attr_simple_read()

The generic function from the sysfs core can replace the custom one.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20241228-sysfs-const-bin_attr-simple-v2-3-7c6f3f1767a3@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
18032c6b 42369b9a

+2 -13
+2 -13
kernel/bpf/btf.c
··· 8011 8011 static LIST_HEAD(btf_modules); 8012 8012 static DEFINE_MUTEX(btf_module_mutex); 8013 8013 8014 - static ssize_t 8015 - btf_module_read(struct file *file, struct kobject *kobj, 8016 - struct bin_attribute *bin_attr, 8017 - char *buf, loff_t off, size_t len) 8018 - { 8019 - const struct btf *btf = bin_attr->private; 8020 - 8021 - memcpy(buf, btf->data + off, len); 8022 - return len; 8023 - } 8024 - 8025 8014 static void purge_cand_cache(struct btf *btf); 8026 8015 8027 8016 static int btf_module_notify(struct notifier_block *nb, unsigned long op, ··· 8071 8082 attr->attr.name = btf->name; 8072 8083 attr->attr.mode = 0444; 8073 8084 attr->size = btf->data_size; 8074 - attr->private = btf; 8075 - attr->read = btf_module_read; 8085 + attr->private = btf->data; 8086 + attr->read_new = sysfs_bin_attr_simple_read; 8076 8087 8077 8088 err = sysfs_create_bin_file(btf_kobj, attr); 8078 8089 if (err) {