All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kasan: fix variable 'tag' set but not used warning
@ 2019-03-07 18:52 Qian Cai
  2019-03-08 13:28   ` Andrey Konovalov
  0 siblings, 1 reply; 3+ messages in thread
From: Qian Cai @ 2019-03-07 18:52 UTC (permalink / raw)
  To: akpm
  Cc: aryabinin, glider, dvyukov, andreyknvl, kasan-dev, linux-mm,
	linux-kernel, Qian Cai

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)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-08 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 18:52 [PATCH] kasan: fix variable 'tag' set but not used warning Qian Cai
2019-03-08 13:28 ` Andrey Konovalov
2019-03-08 13:28   ` Andrey Konovalov

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.