]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/ptdump: Fix sparse warning in hashpagetable.c
authorMichael Ellerman <mpe@ellerman.id.au>
Sun, 30 Jan 2022 18:39:18 +0000 (18:39 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Feb 2022 09:32:11 +0000 (20:32 +1100)
commit08ec745e0dfb482537f989452a9276c533f3a154
tree026e393fadfc06b4a4bdbb3c610bba102c8ea031
parentdcff273b4444b7fb0bc9b069b902cb3a0de13aa9
powerpc/ptdump: Fix sparse warning in hashpagetable.c

As reported by sparse:

  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

The values returned by plpar_pte_read_4() are CPU endian, not __be64, so
assigning them to struct hash_pte confuses sparse. As a minimal fix open
code a struct to hold the values with CPU endian types.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220202053039.691917-1-mpe@ellerman.id.au
arch/powerpc/mm/ptdump/hashpagetable.c