From: "H. Peter Anvin" <hpa@zytor.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] x86/PCI: MMCONFIG: shift wrapping in mcfg_ioremap()
Date: Tue, 18 Jun 2013 20:36:54 +0000 [thread overview]
Message-ID: <51C0C4E6.7020204@zytor.com> (raw)
In-Reply-To: <20130618074024.GE12329@elgon.mountain>
On 06/18/2013 02:40 AM, Dan Carpenter wrote:
> This is a static checker fix. "size" is a u64 here, but "num_buses" is
> only 32 bits so we would hit shift wrapping bugs trying to use larger
> sizes.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
> index bea5249..430ed2b 100644
> --- a/arch/x86/pci/mmconfig_64.c
> +++ b/arch/x86/pci/mmconfig_64.c
> @@ -98,8 +98,7 @@ const struct pci_raw_ops pci_mmcfg = {
> static void __iomem *mcfg_ioremap(struct pci_mmcfg_region *cfg)
> {
> void __iomem *addr;
> - u64 start, size;
> - int num_buses;
> + u64 start, size, num_buses;
>
> start = cfg->address + PCI_MMCFG_BUS_OFFSET(cfg->start_bus);
> num_buses = cfg->end_bus - cfg->start_bus + 1;
>
This seems crazy. PCI is limited to 256 busses per domain, so I suspect
this is a non-issue.
-hpa
prev parent reply other threads:[~2013-06-18 20:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 7:40 [patch] x86/PCI: MMCONFIG: shift wrapping in mcfg_ioremap() Dan Carpenter
2013-06-18 19:53 ` Bjorn Helgaas
2013-06-18 20:36 ` H. Peter Anvin [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=51C0C4E6.7020204@zytor.com \
--to=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.