Skip to contentSkip to conversation

x86: mtrr range check correction

PATCH In review Jan Beulich 2 participants 3 messages Feb 14, 2007 – Feb 20, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: mtrr range check correction

Whether a region is below 1Mb is determined by its start rather than its end.

This hunk got erroneously dropped from a previous patch.

arch/i386/kernel/cpu/mtrr/generic.c +1 -1
@@ -428,7 +428,7 @@ int generic_validate_add_page(unsigned l
 		}
 	}
 
-	if (base + size < 0x100) {
+	if (base < 0x100) {
 		printk(KERN_WARNING "mtrr: cannot set region below 1 MiB (0x%lx000,0x%lx000)\n",
 		       base, size);
 		return -EINVAL;
#1 lore raw
Quoted 11 lines · Jan Beulich

Whether a region is below 1Mb is determined by its start rather than its end.

This hunk got erroneously dropped from a previous patch.

arch/i386/kernel/cpu/mtrr/generic.c int generic_validate_add_page(unsigned l · line 434

Quoted 8 lines
arch/i386/kernel/cpu/mtrr/generic.c +1 -1
@@ -428,7 +428,7 @@ int generic_validate_add_page(unsigned l
 		}
 	}
 
-	if (base + size < 0x100) {
+	if (base < 0x100) {
 		printk(KERN_WARNING "mtrr: cannot set region below 1 MiB (0x%lx000,0x%lx000)\n",
 		       base, size);
 		return -EINVAL;

What about wraparound?

#2 lore raw
Quoted 15 lines
Quoted 1 line
Quoted 1 line

Chuck Ebbert <[email protected]> 18.02.07 22:33 >>>

Quoted 13 lines · Jan Beulich

Whether a region is below 1Mb is determined by its start rather than its end.

This hunk got erroneously dropped from a previous patch.

arch/i386/kernel/cpu/mtrr/generic.c +0 -0
@@ -428,7 +428,7 @@ int generic_validate_add_page(unsigned l
 		}
 	}
 
Quoted 8 lines

arch/i386/kernel/cpu/mtrr/generic.c int generic_validate_add_page(unsigned l · line 434

Quoted 6 lines
arch/i386/kernel/cpu/mtrr/generic.c +1 -1
-	if (base + size < 0x100) {
+	if (base < 0x100) {
 		printk(KERN_WARNING "mtrr: cannot set region below 1 MiB (0x%lx000,0x%lx000)\n",
 		       base, size);
 		return -EINVAL;

What about wraparound?

Should be caught by the subsequent checking of upper bits of first and last byte being identical.

Jan