From: Thomas Gleixner Date: Wed, 13 Feb 2008 10:04:50 +0000 (+0100) Subject: x86: cpa: ensure page alignment X-Git-Tag: v2.6.25-rc2~9^2~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=69b1415e934fc1a796a817e32d84162ae65962f5;p=linux-2.6-omap-h63xx.git x86: cpa: ensure page alignment the cpa API is page aligned - warn about any weird alignments. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index bd61ed13f9c..5d2259468d3 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -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;