From: Ilkka Koskinen ilkka@os.amperecomputing.com
mainline inclusion from mainline-v6.9-rc1 commit bae4d1f86e4d6750d2fc11e040c7d49b180c4b8d category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9IEXU CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id...
------------------------------------------------------
Arm64 doesn't have Model in /proc/cpuinfo and, thus, cpu_desc doesn't get assigned.
Running $ perf data convert --to-json perf.data.json
ends up calling output_json_string() with NULL pointer, which causes a segmentation fault.
Signed-off-by: Ilkka Koskinen ilkka@os.amperecomputing.com Acked-by: Arnaldo Carvalho de Melo acme@redhat.com Cc: James Clark james.clark@arm.com Cc: Evgeny Pistun kotborealis@awooo.ru Signed-off-by: Namhyung Kim namhyung@kernel.org Link: https://lore.kernel.org/r/20240223220458.15282-1-ilkka@os.amperecomputing.co... --- tools/perf/util/data-convert-json.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c index 5bb3c2ba95ca29..09d57efd2d9db4 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -284,7 +284,9 @@ static void output_headers(struct perf_session *session, struct convert_json *c) output_json_key_string(out, true, 2, "os-release", header->env.os_release); output_json_key_string(out, true, 2, "arch", header->env.arch);
- output_json_key_string(out, true, 2, "cpu-desc", header->env.cpu_desc); + if (header->env.cpu_desc) + output_json_key_string(out, true, 2, "cpu-desc", header->env.cpu_desc); + output_json_key_string(out, true, 2, "cpuid", header->env.cpuid); output_json_key_format(out, true, 2, "nrcpus-online", "%u", header->env.nr_cpus_online); output_json_key_format(out, true, 2, "nrcpus-avail", "%u", header->env.nr_cpus_avail);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/6615 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Z...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/6615 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Z...