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]
Message-ID: <CAHTA-uZ5dxh81D090YFVWbeJuko-+ACPbNFVQ8_++j_8sBjaAg@mail.gmail.com>
Date: Tue, 11 Feb 2025 16:38:55 -0600
From: Mitchell Augustin <mitchell.augustin@...onical.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Alex Williamson <alex.williamson@...hat.com>, bhelgaas@...gle.com, 
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org, 
	ilpo.jarvinen@...ux.intel.com, David Laight <david.laight.linux@...il.com>
Subject: Re: [PATCH] PCI: Fix BUILD_BUG_ON usage for old gcc

On Ubuntu's (modern) GCC 13.3.0-6ubuntu2~24.04, both proposed options
also build as expected for me when howmany is set correctly, and fail
as expected when I force howmany = 7.

Tested-by: Mitchell Augustin <mitchell.augustin@...onical.com>

On Tue, Feb 11, 2025 at 4:05 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 02/10, Oleg Nesterov wrote:
> >
> > On 02/10, Alex Williamson wrote:
> > >
> > > @@ -345,7 +345,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
> > >     unsigned int pos, reg;
> > >     u16 orig_cmd;
> > >
> > > -   BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);
> > > +   BUILD_BUG_ON(__builtin_constant_p(howmany) &&
> > > +                howmany > PCI_STD_NUM_BARS);
> >
> > Thanks!
> >
> > Tested-by: Oleg Nesterov <oleg@...hat.com>
>
> Just in case... I agree with David, statically_true() looks a bit
> better and
>
>         BUILD_BUG_ON(statically_true(howmany > PCI_STD_NUM_BARS));
>
> also works for me, so if you decide to update this patch feel free
> to keep my Tested-by.
>
> Oleg.
>


-- 
Mitchell Augustin
Software Engineer - Ubuntu Partner Engineering

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ