[PATCH 1/4] powerpc32: misuse of accessors to pte_t objects

From: Christophe Leroy
Date: Wed Dec 10 2014 - 13:01:46 EST


pte_val() is not meant to be used as L value.
__pte() has to be used to assign value to pte_t.

Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxx>

---
arch/powerpc/include/asm/pgtable.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 316f9a5..5d4fdcc 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -115,24 +115,25 @@ static inline unsigned long pte_pfn(pte_t pte) {

/* Generic modifiers for PTE bits */
static inline pte_t pte_wrprotect(pte_t pte) {
- pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; }
+ pte = __pte(pte_val(pte) & ~(_PAGE_RW | _PAGE_HWWRITE)); return pte; }
static inline pte_t pte_mkclean(pte_t pte) {
- pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; }
+ pte = __pte(pte_val(pte) & ~(_PAGE_DIRTY | _PAGE_HWWRITE));
+ return pte; }
static inline pte_t pte_mkold(pte_t pte) {
- pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
+ pte = __pte(pte_val(pte) & ~_PAGE_ACCESSED); return pte; }
static inline pte_t pte_mkwrite(pte_t pte) {
- pte_val(pte) |= _PAGE_RW; return pte; }
+ pte = __pte(pte_val(pte) | _PAGE_RW); return pte; }
static inline pte_t pte_mkdirty(pte_t pte) {
- pte_val(pte) |= _PAGE_DIRTY; return pte; }
+ pte = __pte(pte_val(pte) | _PAGE_DIRTY); return pte; }
static inline pte_t pte_mkyoung(pte_t pte) {
- pte_val(pte) |= _PAGE_ACCESSED; return pte; }
+ pte = __pte(pte_val(pte) | _PAGE_ACCESSED); return pte; }
static inline pte_t pte_mkspecial(pte_t pte) {
- pte_val(pte) |= _PAGE_SPECIAL; return pte; }
+ pte = __pte(pte_val(pte) | _PAGE_SPECIAL); return pte; }
static inline pte_t pte_mkhuge(pte_t pte) {
return pte; }
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{
- pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot);
+ pte = __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
return pte;
}

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/