From 78a3e6c875d162053b1f9b32479619e16ce54b05 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 30 Jan 2008 13:34:08 +0100 Subject: [PATCH] --- yaml --- r: 80534 b: refs/heads/master c: 6eade8ff461fdf13ec6780602eb5618e0bdaa972 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/mm/pageattr.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 72fe44c2e415..b5e3b501c6d4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4692a1450b4d1000a942022b088c8791749dd65e +refs/heads/master: 6eade8ff461fdf13ec6780602eb5618e0bdaa972 diff --git a/trunk/arch/x86/mm/pageattr.c b/trunk/arch/x86/mm/pageattr.c index 5cfc0d4ade56..145f5edf488a 100644 --- a/trunk/arch/x86/mm/pageattr.c +++ b/trunk/arch/x86/mm/pageattr.c @@ -312,10 +312,10 @@ static int change_page_attr_set(unsigned long addr, int numpages, for (i = 0; i < numpages ; i++) { pte = lookup_address(addr, &level); - if (pte) - current_prot = pte_pgprot(*pte); - else - pgprot_val(current_prot) = 0; + if (!pte) + return -EINVAL; + + current_prot = pte_pgprot(*pte); pgprot_val(new_prot) = pgprot_val(current_prot) | pgprot_val(prot); @@ -356,11 +356,12 @@ static int change_page_attr_clear(unsigned long addr, int numpages, int i, ret; for (i = 0; i < numpages; i++) { + pte = lookup_address(addr, &level); - if (pte) - current_prot = pte_pgprot(*pte); - else - pgprot_val(current_prot) = 0; + if (!pte) + return -EINVAL; + + current_prot = pte_pgprot(*pte); pgprot_val(new_prot) = pgprot_val(current_prot) & ~pgprot_val(prot);