From: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com, stable@dpdk.org
Subject: [PATCH] app/test: fix buffer overflow in table unit tests
Date: Thu, 21 Apr 2022 17:35:27 +0000 [thread overview]
Message-ID: <20220421173528.2152008-1-vladimir.medvedkin@intel.com> (raw)
This patch fixes stack buffer overflow reported by ASAN.
Bugzilla ID: 820
Fixes: 5205954791cb ("app/test: packet framework unit tests")
Cc: cristian.dumitrescu@intel.com
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
app/test/test_table_tables.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c
index d5c5a426bc..010dd5a794 100644
--- a/app/test/test_table_tables.c
+++ b/app/test/test_table_tables.c
@@ -292,10 +292,10 @@ test_table_lpm(void)
struct rte_mbuf *mbufs[RTE_PORT_IN_BURST_SIZE_MAX];
void *table;
char *entries[RTE_PORT_IN_BURST_SIZE_MAX];
- char entry;
+ uint64_t entry;
void *entry_ptr;
int key_found;
- uint32_t entry_size = 1;
+ uint32_t entry_size = sizeof(entry);
/* Initialize params and create tables */
struct rte_table_lpm_params lpm_params = {
@@ -357,7 +357,7 @@ test_table_lpm(void)
struct rte_table_lpm_key lpm_key;
lpm_key.ip = 0xadadadad;
- table = rte_table_lpm_ops.f_create(&lpm_params, 0, 1);
+ table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size);
if (table == NULL)
return -9;
@@ -458,10 +458,10 @@ test_table_lpm_ipv6(void)
struct rte_mbuf *mbufs[RTE_PORT_IN_BURST_SIZE_MAX];
void *table;
char *entries[RTE_PORT_IN_BURST_SIZE_MAX];
- char entry;
+ uint64_t entry;
void *entry_ptr;
int key_found;
- uint32_t entry_size = 1;
+ uint32_t entry_size = sizeof(entry);
/* Initialize params and create tables */
struct rte_table_lpm_ipv6_params lpm_params = {
--
2.25.1
next reply other threads:[~2022-04-21 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 17:35 Vladimir Medvedkin [this message]
2022-04-26 14:03 ` Dumitrescu, Cristian
2022-04-28 10:53 ` David Marchand
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=20220421173528.2152008-1-vladimir.medvedkin@intel.com \
--to=vladimir.medvedkin@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=stable@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).