DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] raw/ioat: fix kvlist free
@ 2020-10-14 10:09 Kevin Laatz
  2020-10-19  8:45 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Laatz @ 2020-10-14 10:09 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Kevin Laatz

There is a null pointer check in 'idxd_vdev_parse_params()' which is
causing a coverity issue. This check is redundant as the same check is
being done in 'rte_kvargs_free()', so it is simply removed in this patch.

In addition, kvlist was only being free'd on one path in this function.
This is fixed by always free'ing kvlist before returning.

Coverity issue: 363049
Fixes: 777edf43ae4f ("raw/ioat: introduce vdev probe for DSA/idxd device")

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 drivers/raw/ioat/idxd_vdev.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ioat/idxd_vdev.c b/drivers/raw/ioat/idxd_vdev.c
index 50d47d05c5..30a53b3b82 100644
--- a/drivers/raw/ioat/idxd_vdev.c
+++ b/drivers/raw/ioat/idxd_vdev.c
@@ -93,23 +93,21 @@ idxd_rawdev_parse_wq(const char *key __rte_unused, const char *value,
 static int
 idxd_vdev_parse_params(struct rte_kvargs *kvlist, struct idxd_vdev_args *args)
 {
+	int ret = 0;
+
 	if (rte_kvargs_count(kvlist, IDXD_ARG_WQ) == 1) {
 		if (rte_kvargs_process(kvlist, IDXD_ARG_WQ,
 				&idxd_rawdev_parse_wq, args) < 0) {
 			IOAT_PMD_ERR("Error parsing %s", IDXD_ARG_WQ);
-			goto free;
+			ret = -EINVAL;
 		}
 	} else {
 		IOAT_PMD_ERR("%s is a mandatory arg", IDXD_ARG_WQ);
-		return -EINVAL;
+		ret = -EINVAL;
 	}
 
-	return 0;
-
-free:
-	if (kvlist)
-		rte_kvargs_free(kvlist);
-	return -EINVAL;
+	rte_kvargs_free(kvlist);
+	return ret;
 }
 
 static int
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH] raw/ioat: fix kvlist free
  2020-10-14 10:09 [dpdk-dev] [PATCH] raw/ioat: fix kvlist free Kevin Laatz
@ 2020-10-19  8:45 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2020-10-19  8:45 UTC (permalink / raw)
  To: Kevin Laatz; +Cc: dev, bruce.richardson

14/10/2020 12:09, Kevin Laatz:
> There is a null pointer check in 'idxd_vdev_parse_params()' which is
> causing a coverity issue. This check is redundant as the same check is
> being done in 'rte_kvargs_free()', so it is simply removed in this patch.
> 
> In addition, kvlist was only being free'd on one path in this function.
> This is fixed by always free'ing kvlist before returning.
> 
> Coverity issue: 363049
> Fixes: 777edf43ae4f ("raw/ioat: introduce vdev probe for DSA/idxd device")
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>

Applied, thanks




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

end of thread, other threads:[~2020-10-19  8:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 10:09 [dpdk-dev] [PATCH] raw/ioat: fix kvlist free Kevin Laatz
2020-10-19  8:45 ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

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


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