From 2226ce346557b79b85de46e5bb47b9102f709180 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 1 Dec 2017 11:30:49 -0700 Subject: [PATCH 1/1] memcpy: use malloc We don't have posix_memalign() everywhere, let's just use malloc. Also free memory when done. Signed-off-by: Jens Axboe --- lib/memcpy.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/memcpy.c b/lib/memcpy.c index f937dd9f..8164ba09 100644 --- a/lib/memcpy.c +++ b/lib/memcpy.c @@ -187,9 +187,9 @@ static int setup_tests(void) void *src, *dst; int i; - if (posix_memalign(&src, page_size, BUF_SIZE)) - return 1; - if (posix_memalign(&dst, page_size, BUF_SIZE)) + src = malloc(BUF_SIZE); + dst = malloc(BUF_SIZE); + if (!src || !dst) return 1; init_rand_seed(&state, 0x8989, 0); @@ -204,6 +204,12 @@ static int setup_tests(void) return 0; } +static void free_tests(void) +{ + free(tests[0].src); + free(tests[0].dst); +} + int fio_memcpy_test(const char *type) { unsigned int test_mask = 0; @@ -259,5 +265,6 @@ int fio_memcpy_test(const char *type) } } + free_tests(); return 0; } -- 2.25.1