lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zg3EOP7ovDge_F-I@x1>
Date: Wed, 3 Apr 2024 18:03:52 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Namhyung Kim <namhyung@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] perf annotate: Initialize 'arch' variable not to
 trip some -Werror=maybe-uninitialized

On Wed, Apr 03, 2024 at 09:01:56AM -0700, Ian Rogers wrote:
> On Wed, Apr 3, 2024 at 8:16 AM Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
> >
> > In some older distros the build is failing due to
> > -Werror=maybe-uninitialized, in this case we know that this isn't the
> > case because 'arch' gets initialized by evsel__get_arch(), so just init
> > it to NULL to silence those cases.
> >
> > E.g.:
> >
> >     32    17.12 opensuse:15.5                 : FAIL gcc version 7.5.0 (SUSE Linux)
> >         util/annotate.c: In function 'hist_entry__get_data_type':
> >     util/annotate.c:2269:15: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >       struct arch *arch;
> >                    ^~~~
> >     cc1: all warnings being treated as errors
> >
> >       43     7.30 ubuntu:18.04-x-powerpc64el    : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
> >     util/annotate.c: In function 'hist_entry__get_data_type':
> >     util/annotate.c:2351:36: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >        if (map__dso(ms->map)->kernel && arch__is(arch, "x86") &&
> >                                         ^~~~~~~~~~~~~~~~~~~~~
> >     cc1: all warnings being treated as errors
> >
> > Cc: Adrian Hunter <adrian.hunter@...el.com>
> > Cc: Ian Rogers <irogers@...gle.com>
> > Cc: Jiri Olsa <jolsa@...nel.org>
> > Cc: Namhyung Kim <namhyung@...nel.org>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> 
> This looks fine but I couldn't line up the errors with code in the
> tree. I was curious why the "maybe-uninitialized" was failing. Perhaps
> evsel__get_arch should set the out argument to NULL when an error
> occurs. This fix is also good but may potentially need repeating for
> other evsel__get_arch cases, so a fix in evsel__get_arch may be
> preferable.
> 
> Reviewed-by: Ian Rogers <irogers@...gle.com>

Yeah, your suggestion is better and I just tested, satisfies the
compilers that were emitting this warning.

I stamped a:

Suggested-by: Ian Rogers <irogers@...gle.com>

and kept your Reviewed-by, ok?

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ