DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] autotests: fix mempool element size in func_reentrancy
Date: Mon, 11 Apr 2016 11:33:23 +0200	[thread overview]
Message-ID: <1460367203-30925-1-git-send-email-olivier.matz@6wind.com> (raw)

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

             reply	other threads:[~2016-04-11  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11  9:33 Olivier Matz [this message]
2016-04-11 10:12 ` Thomas Monjalon
2016-04-11 10:21   ` Olivier Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460367203-30925-1-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).