Skip to contentSkip to conversation

kasan-initialize-tag-to-0xff-in-__kasan_kmalloc.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 3, 2019 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled

     Subject: kasan: initialize tag to 0xff in __kasan_kmalloc
has been removed from the -mm tree.  Its filename was
     kasan-initialize-tag-to-0xff-in-__kasan_kmalloc.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Nathan Chancellor <[email protected]>
Subject: kasan: initialize tag to 0xff in __kasan_kmalloc

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.

---

 mm/kasan/common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kasan/common.c renamed from mm/kasan/common.c~kasan-initialize-tag-to-0xff-in-__kasan_kmalloc +1 -1
@@ -464,7 +464,7 @@ static void *__kasan_kmalloc(struct kmem
 {
 	unsigned long redzone_start;
 	unsigned long redzone_end;
-	u8 tag;
+	u8 tag = 0xff;
 
 	if (gfpflags_allow_blocking(flags))
 		quarantine_reduce();

_

Patches currently in -mm which might be from [email protected] are