After turning on -Wuninitialized in scripts/Makefile.extrawarn or KCFLAGS, when CONFIG_KASAN_SW_TAGS is not set (I found this with x86 allyesconfig):
mm/kasan/common.c:490:40: warning: variable 'tag' is uninitialized when used here [-Wuninitialized]
kasan_unpoison_shadow(set_tag(object, tag), size);
^~~
mm/kasan/kasan.h:178:65: note: expanded from macro 'set_tag'
#define set_tag(addr, tag) ((void *)arch_kasan_set_tag((addr), (tag)))
^~~
mm/kasan/common.c:473:8: note: initialize the variable 'tag' to silence this warning
u8 tag;
^
= '\0'
1 warning generated.
It's not wrong but the comment right above kasan_unpoison_shadow states that tag is ignored when CONFIG_KASAN_SW_TAGS is not set and that checks out when you follow arch_kasan_set_tag, which I assume gets fully evaluated later down in the pipeline. It is simple enough to initialize tag though, unless someone else has a better idea.
Patch sent: https://lore.kernel.org/lkml/[email protected]/
Merged into mainline: https://git.kernel.org/torvalds/c/0600597c854e53d2f9b7a6a718c1da2b8b4cb4db
Most helpful comment
Merged into mainline: https://git.kernel.org/torvalds/c/0600597c854e53d2f9b7a6a718c1da2b8b4cb4db