From: Namhyung Kim Date: Thu, 15 Dec 2022 19:28:09 +0000 (-0800) Subject: perf srcline: Do not return NULL for srcline X-Git-Tag: v6.6.7~3829^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea335ef3ddcdc17d616753743f92718e723341fb;p=platform%2Fkernel%2Flinux-starfive.git perf srcline: Do not return NULL for srcline The code assumes non-NULL srcline value always, let's return the usual SRCLINE_UNKNOWN ("??:0") string instead. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Cc: Adrian Hunter Cc: Andi Kleen Cc: Ingo Molnar Cc: Jiri Olsa Cc: Leo Yan Cc: Milian Wolff Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20221215192817.2734573-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index af468e3..5319efb 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -716,7 +716,7 @@ out: if (!show_addr) return (show_sym && sym) ? - strndup(sym->name, sym->namelen) : NULL; + strndup(sym->name, sym->namelen) : SRCLINE_UNKNOWN; if (sym) { if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "",