提交 6eade8ff 编写于 作者: T Thomas Gleixner 提交者: Ingo Molnar

x86: cpa: clean up change_page_attr_set/clear()

Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 4692a145
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册