From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A99DD28BF for ; Wed, 27 Apr 2016 14:46:59 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 27 Apr 2016 05:46:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,541,1455004800"; d="scan'208";a="941279851" Received: from gklab-246-018.igk.intel.com (HELO stargo) ([10.217.246.18]) by orsmga001.jf.intel.com with SMTP; 27 Apr 2016 05:46:56 -0700 Received: by stargo (sSMTP sendmail emulation); Wed, 27 Apr 2016 14:52:36 +0200 From: Slawomir Mrozowicz To: bruce.richardson@intel.com Cc: dev@dpdk.org, Slawomir Mrozowicz Date: Wed, 27 Apr 2016 14:52:34 +0200 Message-Id: <1461761554-5900-1-git-send-email-slawomirx.mrozowicz@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] lpm: unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 12:47:00 -0000 Fix issue reported by Coverity. Coverity ID 13205: Unchecked return value Unchecked return value check_return: Calling rte_lpm6_add without checking return value Fixes: 5c510e13a9cb ("lpm: add IPv6 support") Signed-off-by: Slawomir Mrozowicz --- lib/librte_lpm/rte_lpm6.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index ba4353c..f4db3fa 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -749,6 +749,7 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) int32_t rule_to_delete_index; uint8_t ip_masked[RTE_LPM6_IPV6_ADDR_SIZE]; unsigned i; + int status = 0; /* * Check input arguments. @@ -790,12 +791,13 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) * Add every rule again (except for the one that was removed from * the rules table). */ - for (i = 0; i < lpm->used_rules; i++) { - rte_lpm6_add(lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth, - lpm->rules_tbl[i].next_hop); + for (i = 0; i < lpm->used_rules && status >= 0; i++) { + status = rte_lpm6_add( + lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth, + lpm->rules_tbl[i].next_hop); } - return 0; + return status; } /* -- 1.9.1