This patch fixes stack buffer overflow reported by ASAN.

Bugzilla ID: 820
Fixes: 5205954791cb ("app/test: packet framework unit tests")
Cc: cristian.dumitre...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medved...@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

Reply via email to