diff options
| author | Jiri Olsa <[email protected]> | 2011-03-07 20:13:40 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2011-03-10 13:54:13 +0000 |
| commit | b9a46bba88001504235459c8410f17e6a7e38008 (patch) | |
| tree | 35687cc87135475ce5be257c878cee6eeaf40f37 /tools/perf/util/trace-event-scripting.c | |
| parent | kprobes: Disabling optimized kprobes for entry text section (diff) | |
| download | kernel-b9a46bba88001504235459c8410f17e6a7e38008.tar.gz kernel-b9a46bba88001504235459c8410f17e6a7e38008.zip | |
perf top: Fix events overflow in top command
The snprintf function returns number of printed characters even if it
cross the size parameter. So passing enough events via '-e' parameter
will cause segmentation fault.
It's reproduced by following command:
perf top -e `perf list | grep Tracepoint | awk -F'[' '\
{gsub(/[[:space:]]+/,"",$1);array[FNR]=$1}END{outputs=array[1];\
for (i=2;i<=FNR;i++){ outputs=outputs "," array[i];};print outputs}'`
Attached patch is adding SNPRINTF macro that provides the overflow check
and returns actuall number of printed characters.
Reported-by: Han Pingtian <[email protected]>
Cc: Han Pingtian <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions
