summaryrefslogtreecommitdiffstats
path: root/arch/x86/events/intel/cstate.c
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2020-11-13 19:31:26 +0100
committerPeter Zijlstra <peterz@infradead.org>2020-11-17 13:15:38 +0100
commitebd19fc372e3e78bf165f230e7c084e304441c08 (patch)
tree1457a5636b1f6f0ed0fca74b32029024b647ff2e /arch/x86/events/intel/cstate.c
parentperf/x86/intel/uncore: Fix Add BW copypasta (diff)
downloadlinux-ebd19fc372e3e78bf165f230e7c084e304441c08.tar.xz
linux-ebd19fc372e3e78bf165f230e7c084e304441c08.zip
perf/x86: fix sysfs type mismatches
This change switches rapl to use PMU_FORMAT_ATTR, and fixes two other macros to use device_attribute instead of kobj_attribute to avoid callback type mismatches that trip indirect call checking with Clang's Control-Flow Integrity (CFI). Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lkml.kernel.org/r/20201113183126.1239404-1-samitolvanen@google.com
Diffstat (limited to 'arch/x86/events/intel/cstate.c')
-rw-r--r--arch/x86/events/intel/cstate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 442e1ed4acd4..4eb7ee5fed72 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -107,14 +107,14 @@
MODULE_LICENSE("GPL");
#define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \
-static ssize_t __cstate_##_var##_show(struct kobject *kobj, \
- struct kobj_attribute *attr, \
+static ssize_t __cstate_##_var##_show(struct device *dev, \
+ struct device_attribute *attr, \
char *page) \
{ \
BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
return sprintf(page, _format "\n"); \
} \
-static struct kobj_attribute format_attr_##_var = \
+static struct device_attribute format_attr_##_var = \
__ATTR(_name, 0444, __cstate_##_var##_show, NULL)
static ssize_t cstate_get_attr_cpumask(struct device *dev,