[PATCH] powerpc/ptdump: Fix sparse warning in hashpagetable.c
Christophe Leroy
christophe.leroy at csgroup.eu
Mon Jan 31 05:39:18 AEDT 2022
arch/powerpc/mm/ptdump/hashpagetable.c:264:29: warning: restricted __be64 degrades to integer
arch/powerpc/mm/ptdump/hashpagetable.c:265:49: warning: restricted __be64 degrades to integer
arch/powerpc/mm/ptdump/hashpagetable.c:267:36: warning: incorrect type in assignment (different base types)
arch/powerpc/mm/ptdump/hashpagetable.c:267:36: expected unsigned long long [usertype]
arch/powerpc/mm/ptdump/hashpagetable.c:267:36: got restricted __be64 [usertype] v
arch/powerpc/mm/ptdump/hashpagetable.c:268:36: warning: incorrect type in assignment (different base types)
arch/powerpc/mm/ptdump/hashpagetable.c:268:36: expected unsigned long long [usertype]
arch/powerpc/mm/ptdump/hashpagetable.c:268:36: got restricted __be64 [usertype] r
struct hash_pte fields have type __be64. Convert them to
regular long before using them.
Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
---
arch/powerpc/mm/ptdump/hashpagetable.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/mm/ptdump/hashpagetable.c b/arch/powerpc/mm/ptdump/hashpagetable.c
index c7f824d294b2..bf60ab1bedb9 100644
--- a/arch/powerpc/mm/ptdump/hashpagetable.c
+++ b/arch/powerpc/mm/ptdump/hashpagetable.c
@@ -261,11 +261,11 @@ static int pseries_find(unsigned long ea, int psize, bool primary, u64 *v, u64 *
if (lpar_rc)
continue;
for (j = 0; j < 4; j++) {
- if (HPTE_V_COMPARE(ptes[j].v, want_v) &&
- (ptes[j].v & HPTE_V_VALID)) {
+ if (HPTE_V_COMPARE(be64_to_cpu(ptes[j].v), want_v) &&
+ (be64_to_cpu(ptes[j].v) & HPTE_V_VALID)) {
/* HPTE matches */
- *v = ptes[j].v;
- *r = ptes[j].r;
+ *v = be64_to_cpu(ptes[j].v);
+ *r = be64_to_cpu(ptes[j].r);
return 0;
}
}
--
2.33.1
More information about the Linuxppc-dev
mailing list