Skip to content

Commit 9999a9f

Browse files
namhyunggregkh
authored andcommitted
perf dwarf-aux: Fix off-by-one in die_get_varname()
[ Upstream commit 3abfcfd ] The die_get_varname() returns "(unknown_type)" string if it failed to find a type for the variable. But it had a space before the opening parenthesis and it made the closing parenthesis cut off due to the off-by-one in the string length (14). Signed-off-by: Namhyung Kim <namhyung@kernel.org> Fixes: 88fd633 ("perf probe: No need to use formatting strbuf method") Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230612234102.3909116-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4e06e8b commit 9999a9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/dwarf-aux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf)
10811081
ret = die_get_typename(vr_die, buf);
10821082
if (ret < 0) {
10831083
pr_debug("Failed to get type, make it unknown.\n");
1084-
ret = strbuf_add(buf, " (unknown_type)", 14);
1084+
ret = strbuf_add(buf, "(unknown_type)", 14);
10851085
}
10861086

10871087
return ret < 0 ? ret : strbuf_addf(buf, "\t%s", dwarf_diename(vr_die));

0 commit comments

Comments
 (0)