kasan: fix variable 'tag' set but not used warning
Subsystems (2)
PATCH 1/1 kasan: fix variable 'tag' set but not used warning
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 <[email protected]>
--- mm/kasan/kasan.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/kasan/kasan.h +4 -1
@@ -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))
Signature · 1 line
2.17.2 (Apple Git-113)
Quoted 32 lines · Qian Cai
set_tag()compiles away whenCONFIG_KASAN_SW_TAGS=n, so makearch_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 <[email protected]>--- mm/kasan/kasan.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)mm/kasan/kasan.h +4
-2@@ -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)) --
Quoted 2 lines
2.17.2 (Apple Git-113)
Reviewed-by Andrey Konovalov <[email protected]>
Thanks!