* [PATCH] ARM: kasan: work around LPAE build warning
@ 2021-07-21 15:16 Arnd Bergmann
2021-07-23 22:51 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-07-21 15:16 UTC (permalink / raw)
To: Andrey Ryabinin, Russell King, Ard Biesheuvel, Mike Rapoport, Abbott Liu
Cc: Arnd Bergmann, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Florian Fainelli, Linus Walleij, kasan-dev,
linux-arm-kernel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
pgd_page_vaddr() returns an 'unsigned long' address, causing a warning
with the memcpy() call in kasan_init():
arch/arm/mm/kasan_init.c: In function 'kasan_init':
include/asm-generic/pgtable-nop4d.h:44:50: error: passing argument 2 of '__memcpy' makes pointer from integer without a cast [-Werror=int-conversion]
44 | #define pgd_page_vaddr(pgd) ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
arch/arm/include/asm/string.h:58:45: note: in definition of macro 'memcpy'
58 | #define memcpy(dst, src, len) __memcpy(dst, src, len)
| ^~~
arch/arm/mm/kasan_init.c:229:16: note: in expansion of macro 'pgd_page_vaddr'
229 | pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
| ^~~~~~~~~~~~~~
arch/arm/include/asm/string.h:21:47: note: expected 'const void *' but argument is of type 'long unsigned int'
21 | extern void *__memcpy(void *dest, const void *src, __kernel_size_t n);
| ~~~~~~~~~~~~^~~
Avoid this by adding an explicit typecast.
Fixes: 5615f69bc209 ("ARM: 9016/2: Initialize the mapping of KASan shadow memory")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mm/kasan_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c
index 9c348042a724..4b1619584b23 100644
--- a/arch/arm/mm/kasan_init.c
+++ b/arch/arm/mm/kasan_init.c
@@ -226,7 +226,7 @@ void __init kasan_init(void)
BUILD_BUG_ON(pgd_index(KASAN_SHADOW_START) !=
pgd_index(KASAN_SHADOW_END));
memcpy(tmp_pmd_table,
- pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
+ (void*)pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
sizeof(tmp_pmd_table));
set_pgd(&tmp_pgd_table[pgd_index(KASAN_SHADOW_START)],
__pgd(__pa(tmp_pmd_table) | PMD_TYPE_TABLE | L_PGD_SWAPPER));
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: kasan: work around LPAE build warning
2021-07-21 15:16 [PATCH] ARM: kasan: work around LPAE build warning Arnd Bergmann
@ 2021-07-23 22:51 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2021-07-23 22:51 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrey Ryabinin, Russell King, Ard Biesheuvel, Mike Rapoport,
Abbott Liu, Arnd Bergmann, Alexander Potapenko, Andrey Konovalov,
Dmitry Vyukov, Florian Fainelli, kasan-dev, Linux ARM,
linux-kernel
On Wed, Jul 21, 2021 at 5:17 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> pgd_page_vaddr() returns an 'unsigned long' address, causing a warning
> with the memcpy() call in kasan_init():
>
> arch/arm/mm/kasan_init.c: In function 'kasan_init':
> include/asm-generic/pgtable-nop4d.h:44:50: error: passing argument 2 of '__memcpy' makes pointer from integer without a cast [-Werror=int-conversion]
> 44 | #define pgd_page_vaddr(pgd) ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))
> | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | |
> | long unsigned int
> arch/arm/include/asm/string.h:58:45: note: in definition of macro 'memcpy'
> 58 | #define memcpy(dst, src, len) __memcpy(dst, src, len)
> | ^~~
> arch/arm/mm/kasan_init.c:229:16: note: in expansion of macro 'pgd_page_vaddr'
> 229 | pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
> | ^~~~~~~~~~~~~~
> arch/arm/include/asm/string.h:21:47: note: expected 'const void *' but argument is of type 'long unsigned int'
> 21 | extern void *__memcpy(void *dest, const void *src, __kernel_size_t n);
> | ~~~~~~~~~~~~^~~
>
> Avoid this by adding an explicit typecast.
>
> Fixes: 5615f69bc209 ("ARM: 9016/2: Initialize the mapping of KASan shadow memory")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I can't think of anything better.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Will you add this patch to Russell's patch tracker?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-23 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 15:16 [PATCH] ARM: kasan: work around LPAE build warning Arnd Bergmann
2021-07-23 22:51 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).