Re: [PATCH] perf symbol: Fix uninitialized return value in symbols__find_by_name()

From: Namhyung Kim
Date: Sat Jul 01 2023 - 21:02:35 EST


On Fri, Jun 30, 2023 at 8:49 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Fri, Jun 30, 2023 at 8:39 AM James Clark <james.clark@xxxxxxx> wrote:
> >
> > found_idx and s aren't initialized, so if no symbol is found then the
> > assert at the end will index off the end of the array causing a
> > segfault. The function also doesn't return NULL when the symbol isn't
> > found even if the assert passes. Fix it by initializing the values and
> > only setting them when something is found.
> >
> > Fixes the following test failure:
> >
> > $ perf test 1
> > 1: vmlinux symtab matches kallsyms : FAILED!
> >
> > Fixes: 259dce914e93 ("perf symbol: Remove symbol_name_rb_node")
> > Signed-off-by: James Clark <james.clark@xxxxxxx>
>
> Thanks, and thanks for the Fixes.
>
> Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

Applied to perf-tools-next, thanks!