Re: [PATCH v1] perf inject: Fix use without initialization of local variables

From: Arnaldo Carvalho de Melo
Date: Mon Jan 13 2025 - 10:49:08 EST


On Wed, Dec 11, 2024 at 09:58:00AM +0000, James Clark wrote:
> On 11/12/2024 6:08 am, Ian Rogers wrote:
> > Local variables were missing initialization and command line
> > processing didn't provide default values.
> >
> > Fixes: 64eed019f3fc ("perf inject: Lazy build-id mmap2 event insertion")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> > ---
> > tools/perf/builtin-inject.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> > index d6989195a061..11e49cafa3af 100644
> > --- a/tools/perf/builtin-inject.c
> > +++ b/tools/perf/builtin-inject.c
> > @@ -2367,10 +2367,10 @@ int cmd_inject(int argc, const char **argv)
> > };
> > int ret;
> > const char *known_build_ids = NULL;
> > - bool build_ids;
> > - bool build_id_all;
> > - bool mmap2_build_ids;
> > - bool mmap2_build_id_all;
> > + bool build_ids = false;
> > + bool build_id_all = false;
> > + bool mmap2_build_ids = false;
> > + bool mmap2_build_id_all = false;
> > struct option options[] = {
> > OPT_BOOLEAN('b', "build-ids", &build_ids,
>
> Reviewed-by: James Clark <james.clark@xxxxxxxxxx>

Thanks, applied to perf-tools-next,

- Arnaldo