patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] mempool: fix ignore return value Coverity issue
@ 2020-11-05 13:51 David Hunt
  2020-11-05 13:58 ` Olivier Matz
  0 siblings, 1 reply; 3+ messages in thread
From: David Hunt @ 2020-11-05 13:51 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, andrew.rybchenko, stable, David Hunt

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@dpdk.org

Signed-off-by: David Hunt <david.hunt@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] mempool: fix ignore return value Coverity issue
  2020-11-05 13:51 [dpdk-stable] [PATCH] mempool: fix ignore return value Coverity issue David Hunt
@ 2020-11-05 13:58 ` Olivier Matz
  2020-11-13 14:29   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2020-11-05 13:58 UTC (permalink / raw)
  To: David Hunt; +Cc: dev, andrew.rybchenko, stable

On Thu, Nov 05, 2020 at 01:51:14PM +0000, David Hunt wrote:
> 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@dpdk.org
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

Thanks David!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] mempool: fix ignore return value Coverity issue
  2020-11-05 13:58 ` Olivier Matz
@ 2020-11-13 14:29   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-11-13 14:29 UTC (permalink / raw)
  To: David Hunt, Olivier Matz; +Cc: dev, andrew.rybchenko, stable

05/11/2020 14:58, Olivier Matz:
> On Thu, Nov 05, 2020 at 01:51:14PM +0000, David Hunt wrote:
> > 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@dpdk.org
> > 
> > Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Thanks David!

This patch is doing nothing else than shutting up Coverity.
Is there any value adding this comment in the code?
Would it be cleaner to mark it as false positive in Coverity itself?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-13 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 13:51 [dpdk-stable] [PATCH] mempool: fix ignore return value Coverity issue David Hunt
2020-11-05 13:58 ` Olivier Matz
2020-11-13 14:29   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git