DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy
@ 2016-04-11  9:33 Olivier Matz
  2016-04-11 10:12 ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2016-04-11  9:33 UTC (permalink / raw)
  To: dev

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 writting outside of the object
boundaries.

Fixes: 104a92bd026 ("app: add reentrancy tests")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test/test_func_reentrancy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index 300a3bc..e5b2821 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))
 #define MEMPOOL_SIZE                        (4)
 
 #define MAX_LCORES	RTE_MAX_MEMZONE / (MAX_ITER_TIMES * 4U)
-- 
2.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy
  2016-04-11  9:33 [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy Olivier Matz
@ 2016-04-11 10:12 ` Thomas Monjalon
  2016-04-11 10:21   ` Olivier Matz
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2016-04-11 10:12 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev

2016-04-11 11:33, Olivier Matz:
> --- 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))

I understand the idea of the patch.
Using uint32_t would probably make a good fix ;)
Applied correctly, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy
  2016-04-11 10:12 ` Thomas Monjalon
@ 2016-04-11 10:21   ` Olivier Matz
  0 siblings, 0 replies; 3+ messages in thread
From: Olivier Matz @ 2016-04-11 10:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



On 04/11/2016 12:12 PM, Thomas Monjalon wrote:
> 2016-04-11 11:33, Olivier Matz:
>> --- 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))
> 
> I understand the idea of the patch.
> Using uint32_t would probably make a good fix ;)
> Applied correctly, thanks

You perfectly got the idea :)
Thanks and sorry for the typo...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-11 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-11  9:33 [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy Olivier Matz
2016-04-11 10:12 ` Thomas Monjalon
2016-04-11 10:21   ` Olivier Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).