From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF34AA04B7; Wed, 14 Oct 2020 12:15:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A9C2C1DDD4; Wed, 14 Oct 2020 12:15:11 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D4C611DC29 for ; Wed, 14 Oct 2020 12:15:09 +0200 (CEST) IronPort-SDR: sSZq/DidLbQjyh/lahaU8U/1RrpTE82NfG/8jMjoqZnJq6rc3kXdHZDtJ9gYPybhTz1oDfWpc3 RRABNLCh/xfw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="166198065" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="166198065" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 03:15:08 -0700 IronPort-SDR: iCcoRfKuU4qN0UPZoYb+tpoVOi/60dHM/THTWGWvHMW7R53kbljpeXMwWIlNePyi/HeqWBR2Ze OlHFSQEUXOKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="520323143" Received: from silpixa00399838.ir.intel.com ([10.237.213.224]) by fmsmga006.fm.intel.com with ESMTP; 14 Oct 2020 03:15:07 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, Kevin Laatz Date: Wed, 14 Oct 2020 11:09:48 +0100 Message-Id: <20201014100948.1210209-1-kevin.laatz@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] raw/ioat: fix kvlist free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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