]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86: Fix active_entry initialization
authorStephane Eranian <eranian@google.com>
Wed, 8 Jan 2014 10:15:52 +0000 (11:15 +0100)
committerIngo Molnar <mingo@kernel.org>
Sun, 12 Jan 2014 09:16:07 +0000 (10:16 +0100)
commitf2ac734e5925a0c141eb9a9e9171d77e3e672cd7
tree17df33246ff0857a737017ff02d86854dc88d50d
parent9598f2c191fd65c5ea6916edee1a8dfec5e9d1d2
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>
include/linux/perf_event.h
kernel/events/core.c