diff options
author | Stephane Eranian <eranian@google.com> | 2014-01-08 11:15:52 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-12 10:16:07 +0100 |
commit | f3ae75de98c4bac145a87d830c156c96f9414022 (patch) | |
tree | 17df33246ff0857a737017ff02d86854dc88d50d /include/linux/perf_event.h | |
parent | fa6e8e5f7cbf85f364ebd5a90525dbbe9de2083b (diff) | |
download | linux-stable-f3ae75de98c4bac145a87d830c156c96f9414022.tar.gz linux-stable-f3ae75de98c4bac145a87d830c156c96f9414022.tar.bz2 linux-stable-f3ae75de98c4bac145a87d830c156c96f9414022.zip |
perf/x86: Fix active_entry initialization
This patch fixes a problem with the initialization of the
struct perf_event active_entry field. It is defined inside
an anonymous union and was initialized in perf_event_alloc()
using INIT_LIST_HEAD(). However at that time, we do not know
whether the event is going to use active_entry or hlist_entry (SW).
Or at last, we don't want to make that determination there.
The problem is that hlist and list_head are not initialized
the same way. One is okay with NULL (from kzmalloc), the other
needs to pointers to point to self.
This patch resolves this problem by dropping the union.
This will avoid problems later on, if someone starts using
active_entry or hlist_entry without verifying that they
actually overlap. This also solves the initialization
problem.
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: ak@linux.intel.com
Cc: acme@redhat.com
Cc: jolsa@redhat.com
Cc: zheng.z.yan@intel.com
Cc: bp@alien8.de
Cc: vincent.weaver@maine.edu
Cc: maria.n.dimakopoulou@gmail.com
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1389176153-3128-2-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 8f4a70f2eca8..e56b07f5c9b6 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -319,10 +319,8 @@ struct perf_event { */ struct list_head migrate_entry; - union { - struct hlist_node hlist_entry; - struct list_head active_entry; - }; + struct hlist_node hlist_entry; + struct list_head active_entry; int nr_siblings; int group_flags; struct perf_event *group_leader; |