From: Peter Zijlstra Date: Fri, 1 May 2009 10:23:18 +0000 (+0200) Subject: perf_counter: tool: handle 0-length data files X-Git-Tag: Ubuntu-5.13.0-19.19~35838^2~315 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=585e3374d9d29376c2c37d821c8b7637dd48ca95;p=mirror_ubuntu-jammy-kernel.git perf_counter: tool: handle 0-length data files Avoid perf-report barfing on 0-length data files. [ Impact: fix perf-report SIGBUS ] Signed-off-by: Peter Zijlstra Cc: Paul Mackerras Cc: Corey Ashford LKML-Reference: <20090501102533.196245693@chello.nl> Signed-off-by: Ingo Molnar --- diff --git a/Documentation/perf_counter/perf-report.cc b/Documentation/perf_counter/perf-report.cc index 933a07544534..911d7f3e7a65 100644 --- a/Documentation/perf_counter/perf-report.cc +++ b/Documentation/perf_counter/perf-report.cc @@ -402,6 +402,11 @@ int main(int argc, char *argv[]) exit(-1); } + if (!stat.st_size) { + fprintf(stderr, "zero-sized file, nothing to do!\n"); + exit(0); + } + load_kallsyms(); remap: