Lines Matching refs:ptr2

275 	char *ptr1, *ptr2;  in krealloc_more_oob_helper()  local
284 ptr2 = krealloc(ptr1, size2, GFP_KERNEL); in krealloc_more_oob_helper()
285 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in krealloc_more_oob_helper()
288 ptr2[size1 - 1] = 'x'; in krealloc_more_oob_helper()
289 ptr2[size1] = 'x'; in krealloc_more_oob_helper()
290 ptr2[middle] = 'x'; in krealloc_more_oob_helper()
291 ptr2[size2 - 1] = 'x'; in krealloc_more_oob_helper()
295 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); in krealloc_more_oob_helper()
299 ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); in krealloc_more_oob_helper()
301 kfree(ptr2); in krealloc_more_oob_helper()
307 char *ptr1, *ptr2; in krealloc_less_oob_helper() local
316 ptr2 = krealloc(ptr1, size2, GFP_KERNEL); in krealloc_less_oob_helper()
317 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in krealloc_less_oob_helper()
320 ptr2[size2 - 1] = 'x'; in krealloc_less_oob_helper()
324 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); in krealloc_less_oob_helper()
328 ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); in krealloc_less_oob_helper()
338 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[middle] = 'x'); in krealloc_less_oob_helper()
339 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1 - 1] = 'x'); in krealloc_less_oob_helper()
340 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1] = 'x'); in krealloc_less_oob_helper()
342 kfree(ptr2); in krealloc_less_oob_helper()
379 char *ptr1, *ptr2; in krealloc_uaf() local
387 KUNIT_EXPECT_KASAN_FAIL(test, ptr2 = krealloc(ptr1, size2, GFP_KERNEL)); in krealloc_uaf()
388 KUNIT_ASSERT_PTR_EQ(test, (void *)ptr2, NULL); in krealloc_uaf()
396 } *ptr1, *ptr2; in kmalloc_oob_16() local
404 ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); in kmalloc_oob_16()
405 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_oob_16()
407 KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2); in kmalloc_oob_16()
409 kfree(ptr2); in kmalloc_oob_16()
416 } *ptr1, *ptr2; in kmalloc_uaf_16() local
421 ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); in kmalloc_uaf_16()
422 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_uaf_16()
423 kfree(ptr2); in kmalloc_uaf_16()
425 KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2); in kmalloc_uaf_16()
571 char *ptr1, *ptr2; in kmalloc_uaf2() local
581 ptr2 = kmalloc(size, GFP_KERNEL); in kmalloc_uaf2()
582 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_uaf2()
588 if (!IS_ENABLED(CONFIG_KASAN_GENERIC) && ptr1 == ptr2 && counter++ < 16) { in kmalloc_uaf2()
589 kfree(ptr2); in kmalloc_uaf2()
594 KUNIT_EXPECT_PTR_NE(test, ptr1, ptr2); in kmalloc_uaf2()
596 kfree(ptr2); in kmalloc_uaf2()