From: Jananee Parthasarathy Date: Tue, 2 Jul 2019 11:21:34 +0000 (+0100) Subject: table: fix crash in LPM IPv6 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=984d9e522fa0522c2cd15863c9790195a630b0b9;p=dpdk.git table: fix crash in LPM IPv6 Unit test table_autotest results in segmentation fault. Crash occurs in test_table_lpm_ipv6_combined(). Variable 'nht_pos0' used as array subscript is not initialized in rte_table_lpm_ipv6_entry_add(). It will not be assigned, if a rule does not exist. In such case a junk number or invalid array index might result in segmentation fault due to array out of bounds when lpm->nht_users is used with such invalid array index. Fix is to initialize the variables used for array subscript. Bugzilla ID: 285 Fixes: d89a5bce1d ("lpm6: extend next hop field") Cc: stable@dpdk.org Signed-off-by: Jananee Parthasarathy Tested-by: David Marchand Acked-by: Cristian Dumitrescu --- diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c index a55f808a4b..4e068d79bf 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.c +++ b/lib/librte_table/rte_table_lpm_ipv6.c @@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add( struct rte_table_lpm_ipv6 *lpm = table; struct rte_table_lpm_ipv6_key *ip_prefix = key; - uint32_t nht_pos, nht_pos0, nht_pos0_valid; + uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0; int status; /* Check input parameters */