perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc
authorAdrian Hunter <adrian.hunter@intel.com>
Wed, 12 Oct 2022 08:22:58 +0000 (11:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:52 +0000 (12:35 +0200)
commitc69a2324fc6b0bbac8d98fab667176e187d8e3fd
treec3fbdfc418fec424b4ee9325c19ace342106dcc3
parente81bf40b280bd42e4e0fe169a27f5402fbb53af5
perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc

commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream.

uClibc segfaulted because NULL was passed as the format to fprintf().

That happened because one of the format strings was missing and
intel_pt_print_info() didn't check that before calling fprintf().

Add the missing format string, and check format is not NULL before calling
fprintf().

Fixes: 11fa7cb86b56d361 ("perf tools: Pass Intel PT information for decoding MTC and CYC")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221012082259.22394-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/perf/util/intel-pt.c