linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Qian Cai <cai@lca.pw>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	 Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	 kasan-dev <kasan-dev@googlegroups.com>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kasan: fix variable 'tag' set but not used warning
Date: Fri, 8 Mar 2019 14:28:14 +0100	[thread overview]
Message-ID: <CAAeHK+xdGubYXJiJi7J=1NH+-iB_yhXgoMWqacf=xh5UnugO1A@mail.gmail.com> (raw)
In-Reply-To: <20190307185244.54648-1-cai@lca.pw>

On Thu, Mar 7, 2019 at 7:53 PM Qian Cai <cai@lca.pw> wrote:
>
> set_tag() compiles away when CONFIG_KASAN_SW_TAGS=n, so make
> arch_kasan_set_tag() a static inline function to fix warnings below.
>
> mm/kasan/common.c: In function '__kasan_kmalloc':
> mm/kasan/common.c:475:5: warning: variable 'tag' set but not used
> [-Wunused-but-set-variable]
>   u8 tag;
>      ^~~
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  mm/kasan/kasan.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index 3e0c11f7d7a1..3ce956efa0cb 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -163,7 +163,10 @@ static inline u8 random_tag(void)
>  #endif
>
>  #ifndef arch_kasan_set_tag
> -#define arch_kasan_set_tag(addr, tag)  ((void *)(addr))
> +static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
> +{
> +       return addr;
> +}
>  #endif
>  #ifndef arch_kasan_reset_tag
>  #define arch_kasan_reset_tag(addr)     ((void *)(addr))
> --
> 2.17.2 (Apple Git-113)
>

Reviewed-by: Andrey Konovalov <andreyknvl@google.com>

Thanks!


      reply	other threads:[~2019-03-08 13:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 18:52 [PATCH] kasan: fix variable 'tag' set but not used warning Qian Cai
2019-03-08 13:28 ` Andrey Konovalov [this message]

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='CAAeHK+xdGubYXJiJi7J=1NH+-iB_yhXgoMWqacf=xh5UnugO1A@mail.gmail.com' \
    --to=andreyknvl@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=cai@lca.pw \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).