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 1AA91A04B5 for ; Wed, 26 Aug 2020 15:07:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF4A11BE80; Wed, 26 Aug 2020 15:07:55 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 214C3255; Wed, 26 Aug 2020 15:07:53 +0200 (CEST) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2424DD6F8FBE8CDCD0D9; Wed, 26 Aug 2020 21:07:51 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Wed, 26 Aug 2020 21:07:42 +0800 From: wangyunjian To: , , CC: , , Yunjian Wang , Date: Wed, 26 Aug 2020 21:07:40 +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.185.168] X-CFilter-Loop: Reflected Subject: [dpdk-stable] [dpdk-dev] [PATCH] event/dpaa2: fix dereference before null check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Yunjian Wang Coverity flags that 'portal' variable is used before it's checked for NULL. This patch fixes this issue. Coverity issue: 323516 Fixes: 4ab57b042e7c ("event/dpaa2: affine portal at runtime during I/O") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/event/dpaa2/dpaa2_eventdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 3ae4441ee..f7383ca73 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -569,14 +569,14 @@ dpaa2_eventdev_port_release(void *port) EVENTDEV_INIT_FUNC_TRACE(); + if (portal == NULL) + return; + /* TODO: Cleanup is required when ports are in linked state. */ if (portal->is_port_linked) DPAA2_EVENTDEV_WARN("Event port must be unlinked before release"); - if (portal) - rte_free(portal); - - portal = NULL; + rte_free(portal); } static int -- 2.23.0