Skip to contentSkip to conversation

perf test llvm: Fix f_mode endianness problem

PATCH New Wang Nan 1 participant 1 message Aug 11, 2017 perf events

lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH 1/1 perf test llvm: Fix f_mode endianness problem

Perf BPF prologue generator unconditionally fetches 8 bytes for function parameters. On big endian machine, a casting is resquired if the parameter is not u64.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Li Zefan <[email protected]>
---
 tools/perf/tests/bpf-script-test-prologue.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/tests/bpf-script-test-prologue.c +3 -1
index b4ebc75..43f1e16 100644
@@ -26,9 +26,11 @@ static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
 	(void *) 6;
 
 SEC("func=null_lseek file->f_mode offset orig")
-int bpf_func__null_lseek(void *ctx, int err, unsigned long f_mode,
+int bpf_func__null_lseek(void *ctx, int err, unsigned long _f_mode,
 			 unsigned long offset, unsigned long orig)
 {
+	fmode_t f_mode = (fmode_t)_f_mode;
+
 	if (err)
 		return 0;
 	if (f_mode & FMODE_WRITE)
Signature · 1 line
2.10.1