[PATCH] perf: enum overflow in uapi/linux/perf_event.h

Christophe Leroy christophe.leroy at c-s.fr
Fri Sep 7 23:27:19 AEST 2018


On PPC32, enums are 32 bits, so __PERF_SAMPLE_CALLCHAIN_EARLY is
out of scope. The following sparse warning is encountered:

  CHECK   arch/powerpc/kernel/process.c
./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0)

This patch changes it to a #define

Fixes: 6cbc304f2f360 ("perf/x86/intel: Fix unwind errors from PEBS entries (mk-II)")
Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
---
 include/uapi/linux/perf_event.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index eeb787b1c53c..27c7842bc86a 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -143,10 +143,10 @@ enum perf_event_sample_format {
 	PERF_SAMPLE_PHYS_ADDR			= 1U << 19,
 
 	PERF_SAMPLE_MAX = 1U << 20,		/* non-ABI */
-
-	__PERF_SAMPLE_CALLCHAIN_EARLY		= 1ULL << 63,
 };
 
+#define __PERF_SAMPLE_CALLCHAIN_EARLY		(1ULL << 63)
+
 /*
  * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
  *
-- 
2.13.3



More information about the Linuxppc-dev mailing list