From: Olivier Matz Date: Mon, 11 Apr 2016 09:33:23 +0000 (+0200) Subject: app/test: fix memory corruption in reentrancy autotest X-Git-Tag: spdx-start~7013 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=411c22d4e09d09f6584fb70145e60bebf723c197;p=dpdk.git app/test: fix memory corruption in reentrancy autotest The mempool element size is set to 0, but 4 bytes are written in my_obj_init(): uint32_t *objnum = obj; memset(obj, 0, mp->elt_size); *objnum = i; Change the MEMPOOL_ELT_SIZE constant to sizeof(uint32_t). This fixes memory corruptions since we were writing outside of the object boundaries. Fixes: 104a92bd026 ("app: add reentrancy tests") Signed-off-by: Olivier Matz --- diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index 300a3bc3db..d6e9dd8feb 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -78,7 +78,7 @@ typedef void (*case_clean_t)(unsigned lcore_id); #define MAX_ITER_TIMES (16) #define MAX_LPM_ITER_TIMES (8) -#define MEMPOOL_ELT_SIZE (0) +#define MEMPOOL_ELT_SIZE (sizeof(uint32_t)) #define MEMPOOL_SIZE (4) #define MAX_LCORES RTE_MAX_MEMZONE / (MAX_ITER_TIMES * 4U)