Skip to content

Commit

Permalink
test/table: fix buffer overflow on lpm entry
Browse files Browse the repository at this point in the history
[ upstream commit a6699a6eb22a763ad4bc7498ca53cf89ab9917dd ]

This patch fixes stack buffer overflow reported by ASan.

Bugzilla ID: 820
Fixes: 5205954 ("app/test: packet framework unit tests")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  • Loading branch information
vmedvedk authored and cpaelzer committed Jul 6, 2022
1 parent fa44459 commit f921474
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/test/test_table_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,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 = {
Expand Down Expand Up @@ -355,7 +355,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;

Expand Down Expand Up @@ -456,10 +456,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 = {
Expand Down

0 comments on commit f921474

Please sign in to comment.