History

perf: Fix perf_event_open(.flags) test

Vince noticed that we test the (unsigned long) flags field against an (unsigned int) constant. This would allow setting the high bits on 64bit platforms and not get an error. There is nothing that uses the high bits, so it should be entirely harmless, but we don't want userspace to accidentally set them anyway, so fix the constants.

Peter Zijlstra committed 12 years ago

Commit 643fd0b1 parent 12665b31 file · +4 −4Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/perf_event.h+4−4
@@ -722,10 +722,10 @@ enum perf_callchain_context { · 721 unmodified lines
722 PERF_CONTEXT_MAX = (__u64)-4095,722 PERF_CONTEXT_MAX = (__u64)-4095,
723};723};
724 724
725#define PERF_FLAG_FD_NO_GROUP (1U << 0)725#define PERF_FLAG_FD_NO_GROUP (1UL << 0)
726#define PERF_FLAG_FD_OUTPUT (1U << 1)726#define PERF_FLAG_FD_OUTPUT (1UL << 1)
727#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */727#define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
728#define PERF_FLAG_FD_CLOEXEC (1U << 3) /* O_CLOEXEC */728#define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */
729 729
730union perf_mem_data_src {730union perf_mem_data_src {
731 __u64 val;731 __u64 val;