mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mitchell Augustin <mitchell.augustin@canonical.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	bhelgaas@google.com,  linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org,  ilpo.jarvinen@linux.intel.com,
	David Laight <david.laight.linux@gmail.com>
Subject: Re: [PATCH] PCI: Fix BUILD_BUG_ON usage for old gcc
Date: Tue, 11 Feb 2025 16:38:55 -0600	[thread overview]
Message-ID: <CAHTA-uZ5dxh81D090YFVWbeJuko-+ACPbNFVQ8_++j_8sBjaAg@mail.gmail.com> (raw)
In-Reply-To: <20250211100502.GA9174@redhat.com>

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@canonical.com>

On Tue, Feb 11, 2025 at 4:05 AM Oleg Nesterov <oleg@redhat.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@redhat.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

      reply	other threads:[~2025-02-11 22:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 21:01 Alex Williamson
2025-02-10 22:00 ` Oleg Nesterov
2025-02-11 10:05   ` Oleg Nesterov
2025-02-11 22:38     ` Mitchell Augustin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHTA-uZ5dxh81D090YFVWbeJuko-+ACPbNFVQ8_++j_8sBjaAg@mail.gmail.com \
    --to=mitchell.augustin@canonical.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=david.laight.linux@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®