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] [day] [month] [year] [list]
Date:   Thu, 15 Apr 2021 15:02:48 -0500
From:   Rob Herring <robh@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Namhyung Kim <namhyung@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH] libperf: xyarray: Add bounds checks to xyarray__entry()

On Thu, Apr 15, 2021 at 2:51 PM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> Em Thu, Apr 15, 2021 at 04:48:34PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Thu, Apr 15, 2021 at 04:46:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Wed, Apr 14, 2021 at 03:53:36PM -0500, Rob Herring escreveu:
> > > > On Wed, Apr 14, 2021 at 3:25 PM Namhyung Kim <namhyung@...nel.org> wrote:
> > > > > > +static inline void *xyarray__entry(struct xyarray *xy, int x, int y)
> > > > > > +{
> > > > > > +       if (x >= xy->max_x || y >= xy->max_y)
> > > > > > +               return NULL;
> > > > >
> > > > > Maybe better to check negatives as well.
> > > >
> > > > max_x and max_y are size_t and unsigned, so x and y will be promoted
> > > > to unsigned and the check will still work.
> > >
> > > Fair enough, applied.
> >
> > So...:
> >
> >   CC       /tmp/build/perf/builtin-script.o
> > In file included from xyarray.c:2:
> > /home/acme/git/perf/tools/lib/perf/include/internal/xyarray.h: In function ‘xyarray__entry’:
> > /home/acme/git/perf/tools/lib/perf/include/internal/xyarray.h:28:8: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
> >    28 |  if (x >= xy->max_x || y >= xy->max_y)
> >       |        ^~
> > /home/acme/git/perf/tools/lib/perf/include/internal/xyarray.h:28:26: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
> >    28 |  if (x >= xy->max_x || y >= xy->max_y)
> >       |                          ^~
> > cc1: all warnings being treated as errors
> >
> >
> > Fedora 33's gcc complains, so I'll cast it to size_t.

I guess gcc 10.2 on ubuntu doesn't yet. I was somewhat expecting to
see something and figured it was fine with -Wall...

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ