All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Ard Biesheuvel <ardb@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	llvm@lists.linux.dev
Subject: [PATCH 11/14] ARM: kasan: work around LPAE build warning
Date: Tue, 28 Sep 2021 17:41:40 +0200	[thread overview]
Message-ID: <20210928154143.2106903-12-arnd@kernel.org> (raw)
In-Reply-To: <20210928154143.2106903-1-arnd@kernel.org>

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")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/all/CACRpkdb3DMvof3-xdtss0Pc6KM36pJA-iy=WhvtNVnsDpeJ24Q@mail.gmail.com/
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


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Ard Biesheuvel <ardb@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	llvm@lists.linux.dev
Subject: [PATCH 11/14] ARM: kasan: work around LPAE build warning
Date: Tue, 28 Sep 2021 17:41:40 +0200	[thread overview]
Message-ID: <20210928154143.2106903-12-arnd@kernel.org> (raw)
In-Reply-To: <20210928154143.2106903-1-arnd@kernel.org>

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")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/all/CACRpkdb3DMvof3-xdtss0Pc6KM36pJA-iy=WhvtNVnsDpeJ24Q@mail.gmail.com/
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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-09-28 15:42 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 15:41 [PATCH 00/14] ARM: randconfig build fixes Arnd Bergmann
2021-09-28 15:41 ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 01/14] ARM: RiscPC needs older gcc version Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 16:03   ` Arnd Bergmann
2021-09-28 16:03     ` Arnd Bergmann
2021-09-28 16:03     ` Arnd Bergmann
2021-09-29  8:45     ` Arnd Bergmann
2021-09-29  8:45       ` Arnd Bergmann
2021-09-29  8:45       ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 02/14] ARM: patch: fix BE32 compilation Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 21:33   ` Linus Walleij
2021-09-28 21:33     ` Linus Walleij
2021-09-28 21:33     ` Linus Walleij
2021-09-28 15:41 ` [PATCH 03/14] ARM: remove duplicate memcpy() definition Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 21:39   ` Linus Walleij
2021-09-28 21:39     ` Linus Walleij
2021-09-28 21:39     ` Linus Walleij
2021-09-28 15:41 ` [PATCH 04/14] ARM: kprobes: address gcc -Wempty-body warning Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 05/14] ARM: ARMv7-M uses BE-8, not BE-32 Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 06/14] ARM: disallow CONFIG_THUMB with ARMv4 Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-29 18:52   ` Nick Desaulniers
2021-09-29 18:52     ` Nick Desaulniers
2021-09-29 18:52     ` Nick Desaulniers
2021-10-06 16:01   ` Ard Biesheuvel
2021-10-06 16:01     ` Ard Biesheuvel
2021-09-28 15:41 ` [PATCH 07/14] ARM: fix link warning with XIP + frame-pointer Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 08/14] ARM: kprobes: fix arch_init_kprobes() prototype Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 09/14] ARM: allow compile-testing without machine record Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` [PATCH 10/14] ARM: only warn about XIP address when not compile testing Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 15:41 ` Arnd Bergmann [this message]
2021-09-28 15:41   ` [PATCH 11/14] ARM: kasan: work around LPAE build warning Arnd Bergmann
2021-09-28 15:41 ` [PATCH 12/14] ARM: add CONFIG_PHYS_OFFSET default values Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 16:02   ` Nicolas Pitre
2021-09-28 16:02     ` Nicolas Pitre
2021-09-28 16:02     ` Nicolas Pitre
2021-09-28 21:44   ` Linus Walleij
2021-09-28 21:44     ` Linus Walleij
2021-09-28 21:44     ` Linus Walleij
2021-09-28 15:41 ` [PATCH 13/14] ARM: use .arch directives instead of assembler command line flags Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 17:10   ` Nick Desaulniers
2021-09-28 17:10     ` Nick Desaulniers
2021-09-28 17:10     ` Nick Desaulniers
2021-09-28 18:32     ` Arnd Bergmann
2021-09-28 18:32       ` Arnd Bergmann
2021-09-28 18:32       ` Arnd Bergmann
2021-09-29 18:11       ` Nick Desaulniers
2021-09-29 18:11         ` Nick Desaulniers
2021-09-29 18:11         ` Nick Desaulniers
2022-01-21 22:17   ` Nathan Chancellor
2022-01-21 22:17     ` Nathan Chancellor
2021-09-28 15:41 ` [PATCH 14/14] [RFC] ARM: forbid ftrace with clang and thumb2_kernel Arnd Bergmann
2021-09-28 15:41   ` Arnd Bergmann
2021-09-28 17:20   ` Nick Desaulniers
2021-09-28 17:20     ` Nick Desaulniers
2021-09-28 17:20     ` Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210928154143.2106903-12-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.