Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] Alchemy: fix off by two error in __fixup_bigphys_addr()
@ 2007-12-10 17:36 Sergei Shtylyov
  2007-12-11 12:19 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2007-12-10 17:36 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips

he PCI specific code in this function doesn't check for the address range being
under the upper bound of the PCI memory window correctly -- fix this, somewhat
beautifying the code around the check, while at it...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
 arch/mips/au1000/common/setup.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/mips/au1000/common/setup.c
===================================================================
--- linux-2.6.orig/arch/mips/au1000/common/setup.c
+++ linux-2.6/arch/mips/au1000/common/setup.c
@@ -137,12 +137,11 @@ phys_t __fixup_bigphys_addr(phys_t phys_
 
 #ifdef CONFIG_PCI
 	{
-		u32 start, end;
+		u32 start = (u32)Au1500_PCI_MEM_START;
+		u32 end   = (u32)Au1500_PCI_MEM_END;
 
-		start = (u32)Au1500_PCI_MEM_START;
-		end = (u32)Au1500_PCI_MEM_END;
-		/* check for pci memory window */
-		if ((phys_addr >= start) && ((phys_addr + size) < end))
+		/* Check for PCI memory window */
+		if (phys_addr >= start && (phys_addr + size - 1) <= end)
 			return (phys_t)
 			       ((phys_addr - start) + Au1500_PCI_MEM_START);
 	}

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

* Re: [PATCH] Alchemy: fix off by two error in __fixup_bigphys_addr()
  2007-12-10 17:36 [PATCH] Alchemy: fix off by two error in __fixup_bigphys_addr() Sergei Shtylyov
@ 2007-12-11 12:19 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2007-12-11 12:19 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-mips

On Mon, Dec 10, 2007 at 08:36:50PM +0300, Sergei Shtylyov wrote:

> he PCI specific code in this function doesn't check for the address range being
> under the upper bound of the PCI memory window correctly -- fix this, somewhat
> beautifying the code around the check, while at it...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

Applied, too.

Thanks,

  Ralf

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

end of thread, other threads:[~2007-12-11 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-10 17:36 [PATCH] Alchemy: fix off by two error in __fixup_bigphys_addr() Sergei Shtylyov
2007-12-11 12:19 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox