Skip to content

Commit

Permalink
perf list: Avoid potential out of bounds memory read
Browse files Browse the repository at this point in the history
If a desc string is 0 length then -1 will be out of bounds, add a
check.

Signed-off-by: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Athira Rajeev <[email protected]>
Cc: Benjamin Gray <[email protected]>
Cc: Changbin Du <[email protected]>
Cc: Clément Le Goffic <[email protected]>
Cc: Colin Ian King <[email protected]>
Cc: Dominique Martinet <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Howard Chu <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jing Zhang <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Junhao He <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Oliver Upton <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Sandipan Das <[email protected]>
Cc: Sun Haiyong <[email protected]>
Cc: Tiezhu Yang <[email protected]>
Cc: Veronika Molnarova <[email protected]>
Cc: Weilin Wang <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Xu Yang <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Yicong Yang <[email protected]>
Cc: Ze Gao <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
captain5050 authored and acmel committed Sep 11, 2024
1 parent 4ae354d commit d3d5c1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/builtin-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi
if (pmu_name && strcmp(pmu_name, "default_core")) {
desc_len = strlen(desc);
desc_len = asprintf(&desc_with_unit,
desc[desc_len - 1] != '.'
desc_len > 0 && desc[desc_len - 1] != '.'
? "%s. Unit: %s" : "%s Unit: %s",
desc, pmu_name);
}
Expand Down

0 comments on commit d3d5c1a

Please sign in to comment.