Skip to content

Commit

Permalink
x86: cpa: ensure page alignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Feb 14, 2008
1 parent 7bfeab9 commit 69b1415
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 69b1415

Please sign in to comment.