diff options
author | Nathan Chancellor <natechancellor@gmail.com> | 2019-05-31 22:30:42 -0700 |
---|---|---|
committer | Paul Lawrence <paullawrence@google.com> | 2019-07-10 09:14:22 -0700 |
commit | 88590f0a97d55a7156cdb09e9d5ecb8d829826e0 (patch) | |
tree | bfcc7c8372482e58f9ae92b436685855a3331ad4 | |
parent | 72dc6d14423e5e806b8394f44042e15564af142d (diff) |
UPSTREAM: kasan: initialize tag to 0xff in __kasan_kmallocASB-2019-07-05_4.14
Upstream commit 0600597c854e53d2f9b7a6a718c1da2b8b4cb4db.
When building with -Wuninitialized and CONFIG_KASAN_SW_TAGS unset, Clang
warns:
mm/kasan/common.c:484:40: warning: variable 'tag' is uninitialized when
used here [-Wuninitialized]
kasan_unpoison_shadow(set_tag(object, tag), size);
^~~
set_tag ignores tag in this configuration but clang doesn't realize it at
this point in its pipeline, as it points to arch_kasan_set_tag as being
the point where it is used, which will later be expanded to (void
*)(object) without a use of tag. Initialize tag to 0xff, as it removes
this warning and doesn't change the meaning of the code.
Link: https://github.com/ClangBuiltLinux/linux/issues/465
Link: http://lkml.kernel.org/r/20190502163057.6603-1-natechancellor@gmail.com
Fixes: 7f94ffbc4c6a ("kasan: add hooks implementation for tag-based mode")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I5860952772ae66e9eaafe138899e14da1892cab6
Bug: 128674696
-rw-r--r-- | mm/kasan/common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/kasan/common.c b/mm/kasan/common.c index de8b1c66bbdb..d5ea31ea00af 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -470,7 +470,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, { unsigned long redzone_start; unsigned long redzone_end; - u8 tag; + u8 tag = 0xff; if (gfpflags_allow_blocking(flags)) quarantine_reduce(); |