sparc32: srmmu: improve type safety of __nocache_fix()
authorMike Rapoport <rppt@linux.ibm.com>
Sat, 27 Jun 2020 08:16:53 +0000 (11:16 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jul 2020 01:25:59 +0000 (18:25 -0700)
commitc0d5b0c721b67d13796914031cc8b9bbf2c7f453
tree9578ec169cd59c43f04aeeeae1ba4fe4b6cfd5d4
parent72a7af33e08083c118b57c93c1456cc9a5045dc6
sparc32: srmmu: improve type safety of __nocache_fix()

The __nocache_fix(VADDR) macro is used to add an offset for pointers and
its "return type" is 'void *'.

We can do better and keep the type information with simply by casting the
return value to (__typeof__(VADDR)).

This will  ".. show when those pgd/p4d/pud pointers get mis-used because
they don't end up dropping the type info.."

The addition of the casting to __nocache_fix() also allows to remove
explicit casts at its call sites.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lkml.kernel.org/r/CAHk-=wisORTa7QVPnFqNw9pFs62UiwgsD4C4d=MtYy1o4JPyGQ@mail.gmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/pgtsrmmu.h
arch/sparc/mm/srmmu.c