Lines Matching refs:buf

51 static void probe_console(void *ignore, const char *buf, size_t len)  in probe_console()  argument
59 if (strnstr(buf, "BUG: KFENCE: ", len) && strnstr(buf, "test_", len)) { in probe_console()
66 strscpy(observed.lines[0], buf, min(len + 1, sizeof(observed.lines[0]))); in probe_console()
68 } else if (nlines == 1 && (strnstr(buf, "at 0x", len) || strnstr(buf, "of 0x", len))) { in probe_console()
69 strscpy(observed.lines[nlines++], buf, min(len + 1, sizeof(observed.lines[0]))); in probe_console()
327 char *buf; in test_out_of_bounds_read() local
340 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_LEFT); in test_out_of_bounds_read()
341 expect.addr = buf - 1; in test_out_of_bounds_read()
344 test_free(buf); in test_out_of_bounds_read()
346 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_RIGHT); in test_out_of_bounds_read()
347 expect.addr = buf + size; in test_out_of_bounds_read()
350 test_free(buf); in test_out_of_bounds_read()
361 char *buf; in test_out_of_bounds_write() local
364 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_LEFT); in test_out_of_bounds_write()
365 expect.addr = buf - 1; in test_out_of_bounds_write()
368 test_free(buf); in test_out_of_bounds_write()
425 char *buf; in test_invalid_addr_free() local
428 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_ANY); in test_invalid_addr_free()
429 expect.addr = buf + 1; /* Free on invalid address. */ in test_invalid_addr_free()
431 test_free(buf); /* No error. */ in test_invalid_addr_free()
442 char *buf; in test_corruption() local
448 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_LEFT); in test_corruption()
449 expect.addr = buf + size; in test_corruption()
451 test_free(buf); in test_corruption()
454 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_RIGHT); in test_corruption()
455 expect.addr = buf - 1; in test_corruption()
457 test_free(buf); in test_corruption()
480 char *buf; in test_kmalloc_aligned_oob_read() local
482 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_RIGHT); in test_kmalloc_aligned_oob_read()
488 READ_ONCE(*(buf - 1)); in test_kmalloc_aligned_oob_read()
495 READ_ONCE(*(buf + size)); in test_kmalloc_aligned_oob_read()
499 expect.addr = buf + size + align; in test_kmalloc_aligned_oob_read()
503 test_free(buf); in test_kmalloc_aligned_oob_read()
513 char *buf; in test_kmalloc_aligned_oob_write() local
515 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_RIGHT); in test_kmalloc_aligned_oob_write()
520 expect.addr = buf + size; in test_kmalloc_aligned_oob_write()
523 test_free(buf); in test_kmalloc_aligned_oob_write()
531 void *buf; in test_shrink_memcache() local
535 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_ANY); in test_shrink_memcache()
537 test_free(buf); in test_shrink_memcache()
607 char *buf; in test_memcache_ctor() local
611 buf = test_alloc(test, size, GFP_KERNEL, ALLOCATE_ANY); in test_memcache_ctor()
614 KUNIT_EXPECT_EQ(test, buf[i], (char)'x'); in test_memcache_ctor()
616 test_free(buf); in test_memcache_ctor()
718 char *buf = expect.addr; in test_krealloc() local
722 KUNIT_EXPECT_EQ(test, ksize(buf), size); /* Precise size match after KFENCE alloc. */ in test_krealloc()
724 buf[i] = i + 1; in test_krealloc()
727 buf = krealloc(buf, size * 3, GFP_KERNEL); /* Grow. */ in test_krealloc()
729 KUNIT_EXPECT_GE(test, ksize(buf), size * 3); in test_krealloc()
731 KUNIT_EXPECT_EQ(test, buf[i], (char)(i + 1)); in test_krealloc()
733 buf[i] = i + 1; in test_krealloc()
735 buf = krealloc(buf, size * 2, GFP_KERNEL); /* Shrink. */ in test_krealloc()
736 KUNIT_EXPECT_GE(test, ksize(buf), size * 2); in test_krealloc()
738 KUNIT_EXPECT_EQ(test, buf[i], (char)(i + 1)); in test_krealloc()
740 buf = krealloc(buf, 0, GFP_KERNEL); /* Free. */ in test_krealloc()
741 KUNIT_EXPECT_EQ(test, (unsigned long)buf, (unsigned long)ZERO_SIZE_PTR); in test_krealloc()