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 49B5AA0521; Tue, 3 Nov 2020 14:32:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D8CACA89; Tue, 3 Nov 2020 14:32:03 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id A4CCBCA49 for ; Tue, 3 Nov 2020 14:32:01 +0100 (CET) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CQW0Z45jCzhdv6; Tue, 3 Nov 2020 21:31:58 +0800 (CST) Received: from localhost (10.174.187.156) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Tue, 3 Nov 2020 21:31:49 +0800 From: wangyunjian To: CC: , , , , , Yunjian Wang Date: Tue, 3 Nov 2020 21:31:48 +0800 Message-ID: X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.156] X-CFilter-Loop: Reflected Subject: [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" 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; + if (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) { ret = rte_eth_rx_queue_check_split(rx_seg, n_seg, &mbp_buf_size, -- 2.18.1