[dpdk-dev] [PATCH] mempool: fix ignore return value Coverity issue

David Hunt david.hunt at intel.com
Thu Nov 5 14:51:14 CET 2020


Coverity flags that rte_mempool_ops_dequeue_bulk() is called without
checking the return value.

This ignoring is intentional, so this patch gets the return code, then
uses RTE_SET_USED so that Coverity will be happy.

Coverity issue: 363744
Fixes: 449c49b93a6b ("mempool: support handler operations")
Cc: stable at dpdk.org

Signed-off-by: David Hunt <david.hunt at intel.com>
---
 lib/librte_mempool/rte_mempool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index b9f3fbd61..2980b1a00 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -270,9 +270,11 @@ rte_mempool_free_memchunks(struct rte_mempool *mp)
 {
 	struct rte_mempool_memhdr *memhdr;
 	void *elt;
+	int ret;
 
 	while (!STAILQ_EMPTY(&mp->elt_list)) {
-		rte_mempool_ops_dequeue_bulk(mp, &elt, 1);
+		ret = rte_mempool_ops_dequeue_bulk(mp, &elt, 1);
+		RTE_SET_USED(ret); /* Intentionally ignored */
 		(void)elt;
 		STAILQ_REMOVE_HEAD(&mp->elt_list, next);
 		mp->populated_size--;
-- 
2.17.1



More information about the dev mailing list