linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Qian Cai <cai@lca.pw>
Cc: catalin.marinas@arm.com, andreyknvl@google.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/mm: fix variable 'tag' set but not used
Date: Thu, 1 Aug 2019 13:01:22 +0100	[thread overview]
Message-ID: <20190801120121.6cmtho3wd32nzfoz@willie-the-truck> (raw)
In-Reply-To: <1564605498-17629-1-git-send-email-cai@lca.pw>

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

  reply	other threads:[~2019-08-01 12:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 20:38 [PATCH] arm64/mm: fix variable 'tag' set but not used Qian Cai
2019-08-01 12:01 ` Will Deacon [this message]
2019-08-01 12:07   ` Qian Cai
2019-08-01 12:09     ` Qian Cai
2019-08-01 12:12     ` Will Deacon

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=20190801120121.6cmtho3wd32nzfoz@willie-the-truck \
    --to=will@kernel.org \
    --cc=andreyknvl@google.com \
    --cc=cai@lca.pw \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 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).