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 CF144A0521; Tue, 3 Nov 2020 14:58:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 47B74CA74; Tue, 3 Nov 2020 14:58:27 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B002DCA6E for ; Tue, 3 Nov 2020 14:58:23 +0100 (CET) IronPort-SDR: nUyGAA8HomGgo5z+j9rucLT4kw6Ylsf++5PZ/8ZP/sBJ2pJBHNYvy9yZQX7oeU7A8qdLceDIox pFGKwRHz2T4Q== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="166461923" X-IronPort-AV: E=Sophos;i="5.77,448,1596524400"; d="scan'208";a="166461923" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 05:58:22 -0800 IronPort-SDR: nmG33JSJqy231eoizbURpTuR7zs/QHF1CmOhpFg0UXw5Kvj71QrjaTnD3cQnkMz2UoD0c91BRq fK61HkTWVB0g== X-IronPort-AV: E=Sophos;i="5.77,448,1596524400"; d="scan'208";a="538498237" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.218.178]) ([10.213.218.178]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 05:58:20 -0800 To: wangyunjian , dev@dpdk.org Cc: thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, jerry.lilijun@huawei.com, xudingke@huawei.com References: From: Ferruh Yigit Message-ID: Date: Tue, 3 Nov 2020 13:58:17 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] ethdev: fix check of rx configure 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" On 11/3/2020 1:31 PM, wangyunjian wrote: > From: Yunjian Wang > > Coverity flags that 'rx_conf' variable is used before > it's checked for NULL. This patch fixes this issue. > > Coverity issue: 363570 > Fixes: 4ff702b5dfa9 ("ethdev: introduce Rx buffer split") > > Signed-off-by: Yunjian Wang > --- > lib/librte_ethdev/rte_ethdev.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index b12bb3854d..c74502d45e 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1978,16 +1978,17 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, > return -EINVAL; > } > } else { > - const struct rte_eth_rxseg_split *rx_seg = > - (const struct rte_eth_rxseg_split *)rx_conf->rx_seg; > - uint16_t n_seg = rx_conf->rx_nseg; > - > /* Extended multi-segment configuration check. */ > if (rx_conf == NULL || rx_conf->rx_seg == NULL || rx_conf->rx_nseg == 0) { > RTE_ETHDEV_LOG(ERR, > "Memory pool is null and no extended configuration provided\n"); > return -EINVAL; > } > + > + const struct rte_eth_rxseg_split *rx_seg = > + (const struct rte_eth_rxseg_split *)rx_conf->rx_seg; > + uint16_t n_seg = rx_conf->rx_nseg; > + Can you please leave the declaration of the variables at the beginning of the block, but move the assignment?