perf ordered_events: Prevent crossing max_alloc_size
authorJiri Olsa <jolsa@kernel.org>
Fri, 7 Sep 2018 10:24:55 +0000 (12:24 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 19 Sep 2018 13:25:08 +0000 (10:25 -0300)
commit53da12e013498c4eca592939bb18a5dbd1d228c9
treed9aa254252a13e629f54dee1c24bd4f12e52ac0d
parentd5ceb62b36545b597e89adb5eb778c3e15431c10
perf ordered_events: Prevent crossing max_alloc_size

Stephane reported a possible issue in the ordered events code, which
could lead to allocating more memory than guarded by max_alloc_size.

He also suggested the fix to properly check that the new size is below
the max_alloc_size limit.

Reported-by: Stephane Eranian <eranian@google.com>
Suggested-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180907102455.7030-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/ordered-events.c