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: <CAMuHMdUuTPpYsLcJ2fnZpYQu36_uOELPBLaOQpmRqLaiHLLXEQ@mail.gmail.com>
Date:   Wed, 23 Jan 2019 09:18:18 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Alex Williamson <alex.williamson@...hat.com>
Cc:     Alexey Kardashevskiy <aik@...abs.ru>,
        linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
        KVM list <kvm@...r.kernel.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH kernel] vfio-pci/nvlink2: Fix ancient gcc warnings

Hi Alex,

On Wed, Jan 23, 2019 at 5:30 AM Alex Williamson
<alex.williamson@...hat.com> wrote:
> The below patch comes about from the build regressions and improvements
> list you've sent out, but something doesn't add up that we'd be testing
> with an old compiler where initialization with { 0 } generates a
> "missing braces around initialization" warning.  Is this really the
> case or are we missing something here?  There's no harm that I can see
> with Alexey's fix, but are these really just false positives from a
> compiler bug that we should selectively ignore if the "fix" is less
> clean?  Thanks,

Yes, they are false positives, AFAIK.

> On Wed, 23 Jan 2019 15:07:11 +1100
> Alexey Kardashevskiy <aik@...abs.ru> wrote:
>
> > Using the {0} construct as a generic initializer is perfectly fine in C,
> > however due to a bug in old gcc there is a warning:
> >
> >   + /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c: warning: (near
> > initialization for 'cap.header') [-Wmissing-braces]:  => 181:9

These all seem to come from an old gcc 4.6, which is the oldest still
supported version for compiling Linux
http://kisskb.ellerman.id.au/kisskb/buildresult/13663641/

Note that kisskb is also using gcc 4.6.3 for s390x and mips, which are the only
other builds showing missing braces warnings.

> > Since for whatever reason we still want to compile the modern kernel
> > with such an old gcc without warnings, this changes the capabilities
> > initialization.
> >
> > The gcc bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
> >
> > Signed-off-by: Alexey Kardashevskiy <aik@...abs.ru>
> > ---
> >  drivers/vfio/pci/vfio_pci_nvlink2.c | 30 ++++++++++++++---------------
> >  1 file changed, 15 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > index 054a2cf..91d945b 100644
> > --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> > +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> > @@ -178,11 +178,11 @@ static int vfio_pci_nvgpu_add_capability(struct vfio_pci_device *vdev,
> >               struct vfio_pci_region *region, struct vfio_info_cap *caps)
> >  {
> >       struct vfio_pci_nvgpu_data *data = region->data;
> > -     struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 };
> > -
> > -     cap.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT;
> > -     cap.header.version = 1;
> > -     cap.tgt = data->gpu_tgt;
> > +     struct vfio_region_info_cap_nvlink2_ssatgt cap = {
> > +             .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT,
> > +             .header.version = 1,
> > +             .tgt = data->gpu_tgt
> > +     };

I think the simpler change

-       struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 };
+       struct vfio_region_info_cap_nvlink2_ssatgt cap = { { 0 } };

should also work (tested with gcc 4.1).
That's how most of these were fixed in the past.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ