Lines Matching refs:ptr2
319 char *ptr1, *ptr2; in krealloc_more_oob_helper() local
328 ptr2 = krealloc(ptr1, size2, GFP_KERNEL); in krealloc_more_oob_helper()
329 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in krealloc_more_oob_helper()
332 OPTIMIZER_HIDE_VAR(ptr2); in krealloc_more_oob_helper()
335 ptr2[size1 - 1] = 'x'; in krealloc_more_oob_helper()
336 ptr2[size1] = 'x'; in krealloc_more_oob_helper()
337 ptr2[middle] = 'x'; in krealloc_more_oob_helper()
338 ptr2[size2 - 1] = 'x'; in krealloc_more_oob_helper()
342 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); in krealloc_more_oob_helper()
346 ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); in krealloc_more_oob_helper()
348 kfree(ptr2); in krealloc_more_oob_helper()
354 char *ptr1, *ptr2; in krealloc_less_oob_helper() local
363 ptr2 = krealloc(ptr1, size2, GFP_KERNEL); in krealloc_less_oob_helper()
364 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in krealloc_less_oob_helper()
367 OPTIMIZER_HIDE_VAR(ptr2); in krealloc_less_oob_helper()
370 ptr2[size2 - 1] = 'x'; in krealloc_less_oob_helper()
374 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size2] = 'x'); in krealloc_less_oob_helper()
378 ptr2[round_up(size2, KASAN_GRANULE_SIZE)] = 'x'); in krealloc_less_oob_helper()
388 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[middle] = 'x'); in krealloc_less_oob_helper()
389 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1 - 1] = 'x'); in krealloc_less_oob_helper()
390 KUNIT_EXPECT_KASAN_FAIL(test, ptr2[size1] = 'x'); in krealloc_less_oob_helper()
392 kfree(ptr2); in krealloc_less_oob_helper()
429 char *ptr1, *ptr2; in krealloc_uaf() local
437 KUNIT_EXPECT_KASAN_FAIL(test, ptr2 = krealloc(ptr1, size2, GFP_KERNEL)); in krealloc_uaf()
438 KUNIT_ASSERT_NULL(test, ptr2); in krealloc_uaf()
446 } *ptr1, *ptr2; in kmalloc_oob_16() local
456 ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); in kmalloc_oob_16()
457 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_oob_16()
460 OPTIMIZER_HIDE_VAR(ptr2); in kmalloc_oob_16()
461 KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2); in kmalloc_oob_16()
463 kfree(ptr2); in kmalloc_oob_16()
470 } *ptr1, *ptr2; in kmalloc_uaf_16() local
477 ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); in kmalloc_uaf_16()
478 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_uaf_16()
479 kfree(ptr2); in kmalloc_uaf_16()
481 KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2); in kmalloc_uaf_16()
647 char *ptr1, *ptr2; in kmalloc_uaf2() local
657 ptr2 = kmalloc(size, GFP_KERNEL); in kmalloc_uaf2()
658 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_uaf2()
664 if (!IS_ENABLED(CONFIG_KASAN_GENERIC) && ptr1 == ptr2 && counter++ < 16) { in kmalloc_uaf2()
665 kfree(ptr2); in kmalloc_uaf2()
670 KUNIT_EXPECT_PTR_NE(test, ptr1, ptr2); in kmalloc_uaf2()
672 kfree(ptr2); in kmalloc_uaf2()
681 char *ptr1, *ptr2; in kmalloc_uaf3() local
691 ptr2 = kmalloc(size, GFP_KERNEL); in kmalloc_uaf3()
692 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); in kmalloc_uaf3()
693 kfree(ptr2); in kmalloc_uaf3()