[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240619204211.6438-2-yskelg@gmail.com>
Date: Thu, 20 Jun 2024 05:42:12 +0900
From: yskelg@...il.com
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>
Cc: kan.liang@...ux.intel.com,
Yang Jihong <yangjihong1@...wei.com>,
Ze Gao <zegao2021@...il.com>,
Leo Yan <leo.yan@...ux.dev>,
Ravi Bangoria <ravi.bangoria@....com>,
Austin Kim <austindh.kim@...il.com>,
shjy180909@...il.com,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
Yunseong Kim <yskelg@...il.com>
Subject: [PATCH] perf unwind-libunwind: Add malloc() failure handling
From: Yunseong Kim <yskelg@...il.com>
Add malloc() failure handling in unread_unwind_spec_debug_frame().
This make caller find_proc_info() works well when the allocation failure.
Signed-off-by: Yunseong Kim <yskelg@...il.com>
---
tools/perf/util/unwind-libunwind-local.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index cde267ea3e99..a424eae6d308 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -390,6 +390,11 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
char *debuglink = malloc(PATH_MAX);
int ret = 0;
+ if (debuglink == NULL) {
+ pr_err("unwind: Can't read unwind spec debug frame.\n");
+ return -ENOMEM;
+ }
+
ret = dso__read_binary_type_filename(
dso, DSO_BINARY_TYPE__DEBUGLINK,
machine->root_dir, debuglink, PATH_MAX);
--
2.45.2
Powered by blists - more mailing lists