diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:34:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:08 -0500 |
commit | 6eade8ff461fdf13ec6780602eb5618e0bdaa972 (patch) | |
tree | c99e2bf6cffc55c7bcc3e87fa024840167ce698d /arch/x86 | |
parent | 4692a1450b4d1000a942022b088c8791749dd65e (diff) |
x86: cpa: clean up change_page_attr_set/clear()
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/pageattr.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 5cfc0d4ade56..145f5edf488a 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -312,10 +312,10 @@ static int change_page_attr_set(unsigned long addr, int numpages, | |||
312 | for (i = 0; i < numpages ; i++) { | 312 | for (i = 0; i < numpages ; i++) { |
313 | 313 | ||
314 | pte = lookup_address(addr, &level); | 314 | pte = lookup_address(addr, &level); |
315 | if (pte) | 315 | if (!pte) |
316 | current_prot = pte_pgprot(*pte); | 316 | return -EINVAL; |
317 | else | 317 | |
318 | pgprot_val(current_prot) = 0; | 318 | current_prot = pte_pgprot(*pte); |
319 | 319 | ||
320 | pgprot_val(new_prot) = | 320 | pgprot_val(new_prot) = |
321 | pgprot_val(current_prot) | pgprot_val(prot); | 321 | pgprot_val(current_prot) | pgprot_val(prot); |
@@ -356,11 +356,12 @@ static int change_page_attr_clear(unsigned long addr, int numpages, | |||
356 | int i, ret; | 356 | int i, ret; |
357 | 357 | ||
358 | for (i = 0; i < numpages; i++) { | 358 | for (i = 0; i < numpages; i++) { |
359 | |||
359 | pte = lookup_address(addr, &level); | 360 | pte = lookup_address(addr, &level); |
360 | if (pte) | 361 | if (!pte) |
361 | current_prot = pte_pgprot(*pte); | 362 | return -EINVAL; |
362 | else | 363 | |
363 | pgprot_val(current_prot) = 0; | 364 | current_prot = pte_pgprot(*pte); |
364 | 365 | ||
365 | pgprot_val(new_prot) = | 366 | pgprot_val(new_prot) = |
366 | pgprot_val(current_prot) & ~pgprot_val(prot); | 367 | pgprot_val(current_prot) & ~pgprot_val(prot); |