summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/testing/selftests/resctrl/fill_buf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c
index c20d0a7ecbe6..3cd0b337eae5 100644
--- a/tools/testing/selftests/resctrl/fill_buf.c
+++ b/tools/testing/selftests/resctrl/fill_buf.c
@@ -14,7 +14,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <inttypes.h>
-#include <malloc.h>
#include <string.h>
#include "resctrl.h"
@@ -64,11 +63,13 @@ static void mem_flush(void *p, size_t s)
static void *malloc_and_init_memory(size_t s)
{
+ void *p = NULL;
uint64_t *p64;
size_t s64;
+ int ret;
- void *p = memalign(PAGE_SIZE, s);
- if (!p)
+ ret = posix_memalign(&p, PAGE_SIZE, s);
+ if (ret < 0)
return NULL;
p64 = (uint64_t *)p;