[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250210220010.GM32480@redhat.com>
Date: Mon, 10 Feb 2025 23:00:11 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, mitchell.augustin@...onical.com,
ilpo.jarvinen@...ux.intel.com
Subject: Re: [PATCH] PCI: Fix BUILD_BUG_ON usage for old gcc
On 02/10, Alex Williamson wrote:
>
> As reported in the below link, it seems older versions of gcc cannot
> determine that the howmany variable is known for all callers. Include
> a test so that newer compilers can still enforce this sanity check and
> older compilers can still work.
>
> Fixes: 4453f360862e ("PCI: Batch BAR sizing operations")
> Link: https://lore.kernel.org/all/20250209154512.GA18688@redhat.com
> Reported-by: Oleg Nesterov <oleg@...hat.com>
> Suggested-by: Oleg Nesterov <oleg@...hat.com>
^^^^^^^^^^^^
Well, thanks, but I didn't ;)
> @@ -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>
Powered by blists - more mailing lists