[PATCH v1] examples/l3fwd: fix for coverity scan

Mohammad Iqbal Ahmad mahmad at marvell.com
Tue Jan 10 15:56:13 CET 2023


This patch fixes (Logically dead code) coverity issue.
This patch also fixes (Uninitialized scalar variable) coverity issue.

Coverity issue: 381687
Coverity issue: 381686
Fixes: 6a094e328598 ("examples/l3fwd: implement FIB lookup method")

Signed-off-by: Mohammad Iqbal Ahmad <mahmad at marvell.com>
---
 examples/l3fwd/l3fwd_fib.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index edc0dd69b9..18398492ae 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -359,10 +359,10 @@ fib_event_loop(struct l3fwd_event_resources *evt_rsrc,
 				nh = (uint16_t)hopsv4[ipv4_arr_assem++];
 			else
 				nh = (uint16_t)hopsv6[ipv6_arr_assem++];
-			if (nh != FIB_DEFAULT_HOP)
-				hops[i] = nh != FIB_DEFAULT_HOP ?
-						  nh :
-						  events[i].mbuf->port;
+
+			hops[i] = nh != FIB_DEFAULT_HOP ?
+				  nh :
+				  events[i].mbuf->port;
 			process_packet(events[i].mbuf, &hops[i]);
 			events[i].mbuf->port = hops[i] != BAD_PORT ?
 						       hops[i] :
-- 
2.25.1



More information about the dev mailing list