All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] x86/PCI: MMCONFIG: shift wrapping in mcfg_ioremap()
@ 2013-06-18  7:40 Dan Carpenter
  2013-06-18 19:53 ` Bjorn Helgaas
  2013-06-18 20:36 ` H. Peter Anvin
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-06-18  7:40 UTC (permalink / raw)
  To: kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-18 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.