From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DA58C43464 for ; Sat, 19 Sep 2020 10:35:27 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id CE92421D42 for ; Sat, 19 Sep 2020 10:35:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE92421D42 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 431901D998; Sat, 19 Sep 2020 12:35:25 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id C2BA01D995; Sat, 19 Sep 2020 12:35:23 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 392CD433BB7B0B0021EE; Sat, 19 Sep 2020 18:35:21 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 18:35:10 +0800 From: wangyunjian To: CC: , , , , , Yunjian Wang , Date: Sat, 19 Sep 2020 18:34:30 +0800 Message-ID: <1600511670-27576-1-git-send-email-wangyunjian@huawei.com> 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-dev] [PATCH] eal: fix dereference before null check 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 This patch fixes (dereference after null check) coverity issue. The intr_handle may be a null pointer which led to this issue. Coverity issue: 357695, 357751 Fixes: 05c4105738d8 ("trace: add interrupt tracepoints") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- lib/librte_eal/freebsd/eal_interrupts.c | 6 ++++-- lib/librte_eal/linux/eal_interrupts.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/freebsd/eal_interrupts.c b/lib/librte_eal/freebsd/eal_interrupts.c index 6d53d33c8..028ab457a 100644 --- a/lib/librte_eal/freebsd/eal_interrupts.c +++ b/lib/librte_eal/freebsd/eal_interrupts.c @@ -380,7 +380,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle) } out: - rte_eal_trace_intr_enable(intr_handle, rc); + if (intr_handle) + rte_eal_trace_intr_enable(intr_handle, rc); return rc; } @@ -418,7 +419,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle) break; } out: - rte_eal_trace_intr_disable(intr_handle, rc); + if (intr_handle) + rte_eal_trace_intr_disable(intr_handle, rc); return rc; } diff --git a/lib/librte_eal/linux/eal_interrupts.c b/lib/librte_eal/linux/eal_interrupts.c index 13db5c4e8..e46443873 100644 --- a/lib/librte_eal/linux/eal_interrupts.c +++ b/lib/librte_eal/linux/eal_interrupts.c @@ -725,7 +725,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle) break; } out: - rte_eal_trace_intr_enable(intr_handle, rc); + if (intr_handle) + rte_eal_trace_intr_enable(intr_handle, rc); return rc; } @@ -852,7 +853,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle) break; } out: - rte_eal_trace_intr_disable(intr_handle, rc); + if (intr_handle) + rte_eal_trace_intr_disable(intr_handle, rc); return rc; } -- 2.23.0