linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf unwind-libunwind: Add malloc() failure handling
@ 2024-06-19 20:42 yskelg
  2024-06-26  4:01 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: yskelg @ 2024-06-19 20:42 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter
  Cc: kan.liang, Yang Jihong, Ze Gao, Leo Yan, Ravi Bangoria,
	Austin Kim, shjy180909, linux-perf-users, linux-kernel,
	Yunseong Kim

From: Yunseong Kim <yskelg@gmail.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@gmail.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


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

* Re: [PATCH] perf unwind-libunwind: Add malloc() failure handling
  2024-06-19 20:42 [PATCH] perf unwind-libunwind: Add malloc() failure handling yskelg
@ 2024-06-26  4:01 ` Namhyung Kim
  2024-06-26 15:47   ` Yunseong Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-06-26  4:01 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, yskelg
  Cc: kan.liang, Yang Jihong, Ze Gao, Leo Yan, Ravi Bangoria,
	Austin Kim, shjy180909, linux-perf-users, linux-kernel

On Thu, 20 Jun 2024 05:42:12 +0900, yskelg@gmail.com wrote:

> Add malloc() failure handling in unread_unwind_spec_debug_frame().
> This make caller find_proc_info() works well when the allocation failure.
> 
> 

Applied to perf-tools-next, thanks!

Best regards,
Namhyung

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

* Re: [PATCH] perf unwind-libunwind: Add malloc() failure handling
  2024-06-26  4:01 ` Namhyung Kim
@ 2024-06-26 15:47   ` Yunseong Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Yunseong Kim @ 2024-06-26 15:47 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Mark Rutland, Jiri Olsa,
	Ian Rogers, Adrian Hunter
  Cc: kan.liang, Yang Jihong, Ze Gao, Leo Yan, Ravi Bangoria,
	Austin Kim, linux-perf-users, linux-kernel, MichelleJin

Hi Namhyung,

On 6/26/24 1:01 오후, Namhyung Kim wrote:
> On Thu, 20 Jun 2024 05:42:12 +0900, yskelg@gmail.com wrote:

>> This patch resolve following warning.
>>
>> tools/perf/util/evsel.c:1620:9: error: result of comparison of constant
>> -1 with expression of type 'char' is always false
>>  -Werror,-Wtautological-constant-out-of-range-compare
>>  1620 |                 if (c == -1)
>>       |                     ~ ^  ~~
>>
>> [...]

> Applied to perf-tools-next, thanks!

Thank you!

>> Add malloc() failure handling in unread_unwind_spec_debug_frame().
>> This make caller find_proc_info() works well when the allocation failure.
>>
>>
> 
> Applied to perf-tools-next, thanks!
> 
> Best regards,
> Namhyung


Thank you for applying my patch set.

I've been looking up the feedback you provided earlier and analyzing it
further.

Next time, I will strive to send a more meaningful patch set.


Warm regards,
Yunseong Kim

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

end of thread, other threads:[~2024-06-26 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 20:42 [PATCH] perf unwind-libunwind: Add malloc() failure handling yskelg
2024-06-26  4:01 ` Namhyung Kim
2024-06-26 15:47   ` Yunseong Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).