* [PATCH] arm64: avoid clang warning about self-assignment
@ 2019-02-22 14:42 Arnd Bergmann
2019-02-22 15:50 ` Andrey Konovalov
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-02-22 14:42 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: natechancellor, ndesaulniers, Arnd Bergmann, Andrey Konovalov,
Andrey Ryabinin, Dmitry Vyukov, linux-arm-kernel, linux-kernel
Building a preprocessed source file for arm64 now always produces
a warning with clang because of the page_to_virt() macro assigning
a variable to itself.
Adding a new temporary variable avoids this issue.
Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm64/include/asm/memory.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index b01ef0180a03..290195168bb3 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -312,8 +312,9 @@ static inline void *phys_to_virt(phys_addr_t x)
#define page_to_virt(page) ({ \
unsigned long __addr = \
((__page_to_voff(page)) | PAGE_OFFSET); \
- __addr = __tag_set(__addr, page_kasan_tag(page)); \
- ((void *)__addr); \
+ unsigned long __addr_tag = \
+ __tag_set(__addr, page_kasan_tag(page)); \
+ ((void *)__addr_tag); \
})
#define virt_to_page(vaddr) ((struct page *)((__virt_to_pgoff(vaddr)) | VMEMMAP_START))
--
2.20.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: avoid clang warning about self-assignment
2019-02-22 14:42 [PATCH] arm64: avoid clang warning about self-assignment Arnd Bergmann
@ 2019-02-22 15:50 ` Andrey Konovalov
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Konovalov @ 2019-02-22 15:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Catalin Marinas, Will Deacon, natechancellor, Nick Desaulniers,
Andrey Ryabinin, Dmitry Vyukov, Linux ARM, LKML
On Fri, Feb 22, 2019 at 3:43 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> Building a preprocessed source file for arm64 now always produces
> a warning with clang because of the page_to_virt() macro assigning
> a variable to itself.
>
> Adding a new temporary variable avoids this issue.
>
> Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Thanks!
> ---
> arch/arm64/include/asm/memory.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index b01ef0180a03..290195168bb3 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -312,8 +312,9 @@ static inline void *phys_to_virt(phys_addr_t x)
> #define page_to_virt(page) ({ \
> unsigned long __addr = \
> ((__page_to_voff(page)) | PAGE_OFFSET); \
> - __addr = __tag_set(__addr, page_kasan_tag(page)); \
> - ((void *)__addr); \
> + unsigned long __addr_tag = \
> + __tag_set(__addr, page_kasan_tag(page)); \
> + ((void *)__addr_tag); \
> })
>
> #define virt_to_page(vaddr) ((struct page *)((__virt_to_pgoff(vaddr)) | VMEMMAP_START))
> --
> 2.20.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-22 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 14:42 [PATCH] arm64: avoid clang warning about self-assignment Arnd Bergmann
2019-02-22 15:50 ` Andrey Konovalov
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).