All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf unwind: handle allocation failure in libdw__get_entries()
@ 2026-08-18 14:24 Triet Hoang
  2026-08-18 14:29 ` sashiko-bot
  0 siblings, 1 reply; 7+ messages in thread
From: Triet Hoang @ 2026-08-18 14:24 UTC (permalink / raw)
  To: linux-perf-users
  Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, james.clark, linux-kernel,
	Triet Hoang

Check the return value of zalloc() before dereferencing the allocated
dwfl_ui_ti structure.

Return -ENOMEM when the allocation fails to avoid a NULL pointer
dereference.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 tools/perf/util/unwind-libdw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 7f35042be567..ff36552ca175 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -379,6 +379,9 @@ int libdw__get_entries(unwind_entry_cb_t cb, void *arg,
 		dwfl = dwfl_ui_ti->dwfl;
 	} else {
 		dwfl_ui_ti = zalloc(sizeof(*dwfl_ui_ti));
+		if (!dwfl_ui_ti)
+			return -ENOMEM;
+
 		dwfl = dwfl_begin(&offline_callbacks);
 		if (!dwfl)
 			goto out;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-08 21:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 14:24 [PATCH] perf unwind: handle allocation failure in libdw__get_entries() Triet Hoang
2026-08-18 14:29 ` sashiko-bot
2026-08-18 14:48   ` [PATCH v2] " Triet Hoang
2026-08-18 14:59     ` sashiko-bot
2026-08-18 19:24     ` Markus Elfring
2026-08-29 20:42     ` Namhyung Kim
2026-09-08 21:51       ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.