Commit b8ae4865 authored by Hugh Dickins's avatar Hugh Dickins Committed by David S. Miller

[SPARC64] mm: don't re-evaluate *ptep

sparc64 prom_callback and new_setup_frame32 each operates on a user page
table without holding lock, and no doubt they've good reason.  But I'd
feel more confident if they were to do a "pte = *ptep" and then operate
on pte, rather than re-evaluating *ptep.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a820fa7
...@@ -154,6 +154,7 @@ int prom_callback(long *args) ...@@ -154,6 +154,7 @@ int prom_callback(long *args)
pud_t *pudp; pud_t *pudp;
pmd_t *pmdp; pmd_t *pmdp;
pte_t *ptep; pte_t *ptep;
pte_t pte;
for_each_process(p) { for_each_process(p) {
mm = p->mm; mm = p->mm;
...@@ -178,8 +179,9 @@ int prom_callback(long *args) ...@@ -178,8 +179,9 @@ int prom_callback(long *args)
* being called from inside OBP. * being called from inside OBP.
*/ */
ptep = pte_offset_map(pmdp, va); ptep = pte_offset_map(pmdp, va);
if (pte_present(*ptep)) { pte = *ptep;
tte = pte_val(*ptep); if (pte_present(pte)) {
tte = pte_val(pte);
res = PROM_TRUE; res = PROM_TRUE;
} }
pte_unmap(ptep); pte_unmap(ptep);
...@@ -218,6 +220,7 @@ int prom_callback(long *args) ...@@ -218,6 +220,7 @@ int prom_callback(long *args)
pud_t *pudp; pud_t *pudp;
pmd_t *pmdp; pmd_t *pmdp;
pte_t *ptep; pte_t *ptep;
pte_t pte;
int error; int error;
if ((va >= LOW_OBP_ADDRESS) && (va < HI_OBP_ADDRESS)) { if ((va >= LOW_OBP_ADDRESS) && (va < HI_OBP_ADDRESS)) {
...@@ -240,8 +243,9 @@ int prom_callback(long *args) ...@@ -240,8 +243,9 @@ int prom_callback(long *args)
* being called from inside OBP. * being called from inside OBP.
*/ */
ptep = pte_offset_kernel(pmdp, va); ptep = pte_offset_kernel(pmdp, va);
if (pte_present(*ptep)) { pte = *ptep;
tte = pte_val(*ptep); if (pte_present(pte)) {
tte = pte_val(pte);
res = PROM_TRUE; res = PROM_TRUE;
} }
goto done; goto done;
......
...@@ -863,6 +863,7 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -863,6 +863,7 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
pud_t *pudp = pud_offset(pgdp, address); pud_t *pudp = pud_offset(pgdp, address);
pmd_t *pmdp = pmd_offset(pudp, address); pmd_t *pmdp = pmd_offset(pudp, address);
pte_t *ptep; pte_t *ptep;
pte_t pte;
regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2); regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2);
...@@ -873,9 +874,10 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -873,9 +874,10 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
preempt_disable(); preempt_disable();
ptep = pte_offset_map(pmdp, address); ptep = pte_offset_map(pmdp, address);
if (pte_present(*ptep)) { pte = *ptep;
if (pte_present(pte)) {
unsigned long page = (unsigned long) unsigned long page = (unsigned long)
page_address(pte_page(*ptep)); page_address(pte_page(pte));
wmb(); wmb();
__asm__ __volatile__("flush %0 + %1" __asm__ __volatile__("flush %0 + %1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment