Skip to contentSkip to conversation

test_kasan: make kmalloc_oob_krealloc_less more correctly

RFC PATCH New Wang Long 1 participant 1 message Aug 21, 2015 Library code

lore
Share & tools
lore

Wang Long

author
#0 lore raw

RFC PATCH 1/1 test_kasan: make kmalloc_oob_krealloc_less more correctly

In kmalloc_oob_krealloc_less, I think it is better to test the size2 boundary.

If we do not call krealloc, the access of position size1 will still cause out-of-bounds and access of position size2 does not. After call krealloc, the access of position size2 cause out-of-bounds. So, use size2 is more correctly.

---
 lib/test_kasan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_kasan.c +1 -1
index 044c54d..c1efb1b 100644
@@ -114,7 +114,7 @@ static noinline void __init kmalloc_oob_krealloc_less(void)
 		kfree(ptr1);
 		return;
 	}
-	ptr2[size1] = 'x';
+	ptr2[size2] = 'x';
 	kfree(ptr2);
 }
 
Signature · 1 line
1.8.3.4