]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf annotate: Use an array for the disassembler preference
authorIan Rogers <irogers@google.com>
Fri, 24 Jan 2025 04:38:56 +0000 (20:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Feb 2025 09:02:13 +0000 (10:02 +0100)
commitbcd487b51eb07b8f04f40aba804b823db4e93f2f
tree37d2a9e7cfff7a44def0998ca34d4312ca260257
parent2013c95df6752d9c88221d0f0f37b6f197969390
perf annotate: Use an array for the disassembler preference

[ Upstream commit bde4ccfd5ab5361490514fc4af7497989cfbee17 ]

Prior to this change a string was used which could cause issues with
an unrecognized disassembler in symbol__disassembler. Change to
initializing an array of perf_disassembler enum values. If a value
already exists then adding it a second time is ignored to avoid array
out of bounds problems present in the previous code, it also allows a
statically sized array and removes memory allocation needs. Errors in
the disassembler string are reported when the config is parsed during
perf annotate or perf top start up. If the array is uninitialized
after processing the config file the default llvm, capstone then
objdump values are added but without a need to parse a string.

Fixes: a6e8a58de629 ("perf disasm: Allow configuring what disassemblers to use")
Closes: https://lore.kernel.org/lkml/CAP-5=fUdfCyxmEiTpzS2uumUp3-SyQOseX2xZo81-dQtWXj6vA@mail.gmail.com/
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20250124043856.1177264-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/annotate.c
tools/perf/util/annotate.h
tools/perf/util/disasm.c