summaryrefslogtreecommitdiffstats
path: root/mm/kasan/kasan_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/kasan/kasan_test.c')
-rw-r--r--mm/kasan/kasan_test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c
index 34515a106c..23906e886b 100644
--- a/mm/kasan/kasan_test.c
+++ b/mm/kasan/kasan_test.c
@@ -451,7 +451,8 @@ static void kmalloc_oob_16(struct kunit *test)
/* This test is specifically crafted for the generic mode. */
KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_KASAN_GENERIC);
- ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL);
+ /* RELOC_HIDE to prevent gcc from warning about short alloc */
+ ptr1 = RELOC_HIDE(kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL), 0);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL);