From 28b60edaa207f871f1be6f32eab1403fcad8f94c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 2 Jun 2024 11:25:13 +0200 Subject: [PATCH] Use posix_memalign() for pnf_p7_t creation Some L1 functions might get a pointer to P7 structures, and use SIMD in which case the memory access needs to be aligned. --- nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c index 9b78d80fd3..76cf22cd83 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c @@ -21,10 +21,11 @@ nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create() { - pnf_p7_t* _this = (pnf_p7_t*)calloc(1, sizeof(pnf_p7_t)); + pnf_p7_t* _this = NULL; + int rc = posix_memalign((void**)&_this, 32, sizeof(pnf_p7_t)); - if(_this == 0) - return 0; + if (_this == NULL || rc != 0) + return 0; // set the default parameters