examples/l3fwd: fix unchecked function return values

Message ID 20200513202026.5091-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/l3fwd: fix unchecked function return values |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Pavan Nikhilesh Bhagavatula May 13, 2020, 8:20 p.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Fix unchecked return values reported by coverity.

Coverity issue: 354235
Fixes: 8bd537e9c6cf ("examples/l3fwd: add service core setup based on caps")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/l3fwd/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Thomas Monjalon May 19, 2020, 4:45 p.m. UTC | #1
13/05/2020 22:20, pbhagavatula@marvell.com:
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Fix unchecked return values reported by coverity.
> 
> Coverity issue: 354235
> Fixes: 8bd537e9c6cf ("examples/l3fwd: add service core setup based on caps")
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Applied, thanks
  

Patch

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 84f171f18..24ede4290 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1112,8 +1112,9 @@  l3fwd_service_enable(uint32_t service_id)
 	/* Get the core which has least number of services running. */
 	while (slcore_count--) {
 		/* Reset default mapping */
-		rte_service_map_lcore_set(service_id,
-				slcore_array[slcore_count], 0);
+		if (rte_service_map_lcore_set(service_id,
+				slcore_array[slcore_count], 0) != 0)
+			return -ENOENT;
 		service_count = rte_service_lcore_count_services(
 				slcore_array[slcore_count]);
 		if (service_count < min_service_count) {