Skip to contentSkip to conversation

x86_64: Fix off by one in e820_mapped

PATCH In review Eric W. Biederman 2 participants 2 messages Jul 29, 2005 – Aug 3, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64: Fix off by one in e820_mapped

This allows a valid iommu placed immediately after memory to work, to be recognized as after the last byte of memory and not overlapping it.

---

 arch/x86_64/kernel/e820.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

a0929b87b8d0d059a10eb3e61da3d679d64980e1

arch/x86_64/kernel/e820.c +1 -1
@@ -85,7 +85,7 @@ int __init e820_mapped(unsigned long sta
 		struct e820entry *ei = &e820.map[i]; 
 		if (type && ei->type != type) 
 			continue;
-		if (ei->addr >= end || ei->addr + ei->size < start) 
+		if (ei->addr >= end || ei->addr + ei->size <= start) 
 			continue; 
 		return 1; 
 	} 
#1 lore raw
Quoted 4 lines · Eric W. Biederman

This allows a valid iommu placed immediately after memory to work, to be recognized as after the last byte of memory and not overlapping it.

Looks good thanks. I see Andrew has already queued it up.

-Andi

Quoted 20 lines

---

 arch/x86_64/kernel/e820.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

a0929b87b8d0d059a10eb3e61da3d679d64980e1

arch/x86_64/kernel/e820.c +1 -1
@@ -85,7 +85,7 @@ int __init e820_mapped(unsigned long sta
 		struct e820entry *ei = &e820.map[i]; 
 		if (type && ei->type != type) 
 			continue;
-		if (ei->addr >= end || ei->addr + ei->size < start) 
+		if (ei->addr >= end || ei->addr + ei->size <= start) 
 			continue; 
 		return 1; 
 	}