x86: cpa: ensure page alignment
authorThomas Gleixner <tglx@linutronix.de>
Wed, 13 Feb 2008 10:04:50 +0000 (11:04 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 14 Feb 2008 22:30:20 +0000 (23:30 +0100)
the cpa API is page aligned - warn about any weird alignments.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/pageattr.c

index bd61ed13f9cf5a1c13b2e7a052e5bc009001866d..5d2259468d3cdce0cfdedb22a5a42f2dfdb9d487 100644 (file)
@@ -688,6 +688,15 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
        if (!pgprot_val(mask_set) && !pgprot_val(mask_clr))
                return 0;
 
+       /* Ensure we are PAGE_SIZE aligned */
+       if (addr & ~PAGE_MASK) {
+               addr &= PAGE_MASK;
+               /*
+                * People should not be passing in unaligned addresses:
+                */
+               WARN_ON_ONCE(1);
+       }
+
        cpa.vaddr = addr;
        cpa.numpages = numpages;
        cpa.mask_set = mask_set;