lkml.org 
[lkml]   [2019]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64/mm: fix variable 'tag' set but not used
On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
> warning,
>
> mm/kasan/common.c: In function '__kasan_kmalloc':
> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
> [-Wunused-but-set-variable]
> u8 tag = 0xff;
> ^~~
>
> Fix it by making __tag_set() a static inline function.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
> arch/arm64/include/asm/memory.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index b7ba75809751..9645b1340afe 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
> #define __tag_reset(addr) untagged_addr(addr)
> #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
> #else
> -#define __tag_set(addr, tag) (addr)
> +static inline const void *__tag_set(const void *addr, u8 tag)
> +{
> + return addr;
> +}

Why doesn't this trigger a warning in page_to_virt(), which passes an
unsigned long for the address parameter?

Will

\
 
 \ /
  Last update: 2019-08-01 14:02    [W:0.038 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site