From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2393DA0540; Wed, 6 Jul 2022 09:24:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C89EF40DF7; Wed, 6 Jul 2022 09:24:38 +0200 (CEST) Received: from out203-205-221-231.mail.qq.com (out203-205-221-231.mail.qq.com [203.205.221.231]) by mails.dpdk.org (Postfix) with ESMTP id 5BD9640691 for ; Wed, 6 Jul 2022 09:24:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1657092265; bh=2NRKNpC4wVu0t0uLzcfbBafp4e1OFOTqycTCISfYN0k=; h=From:To:Cc:Subject:Date; b=lhDCx8nPkcmyEPupA0XiajDAnYj6a4zFEGaP4GUfYA/lJ/vSckvaFGsGgjVhqIxtZ OrrAIrRPewkhddjHhe40DTjVvtLstyC8e/3rda+wdqiRhifwMvNHB+IRagqXodbuUi SCRbI6QVU6YtrMqB3y0CRcllwn7hZRI9PZjEVwfk= Received: from localhost.localdomain ([202.192.80.120]) by newxmesmtplogicsvrsza7.qq.com (NewEsmtp) with SMTP id 61399803; Wed, 06 Jul 2022 15:24:19 +0800 X-QQ-mid: xmsmtpt1657092259tk4vh6p0d Message-ID: X-QQ-XMAILINFO: NY/MPejODIJVWa8YHgulxcpVRm7Vw/nfeN82IAg8kOcJG4bZOtru04RIvLV+8N DyEruShEILCgjYdD4d0XmuiZJOKerK+UlQ1IXfVs0gPbg+zoutBq62jKZ3FEuAnP0ABJNQxtKaKQ gEkcWjchKvy2O9yGfIT68Wqu12R9DVUXbAT27ZecqqTLNV0iPQ9b4eYmvEFMVoQBAqaRqfQedzab aUK1wInWiP9L0ZGkCsbWoC11lBRiaQjoTe7w/kg1uGAzYjXKRWY4AarkrNXxOzvhXzPsWX/w3q3n /wbID+iIKH4MoPS7Iwqgpgexi+7520hfUv4QiCYRNhxSDsom6z2SnCpIBT6prVXm1CVaYusax3fY enMF5zIn61eUTPOKsTP7MsgtXASTTHpKdePij//QST7uXhcNIo50GjboMTs7E9QnaP7pko1xSDcS 3g9T4QSN44JIaa+XQ6tZZlLqbhY3DRpYc140FIlRWxvunFTMTkbD0Ae3/GOxsCfUr/nFw6mjBYle 3Gu0AYOmPbhOgoSLUMvOsOkoluFtugDynx8PgcVeY1EiwvEWQ/LlJR8r9kNscL8zq0C4iPS9/3JQ rz0rkBzUeuinSY8wKZFKa5aIki63NfRZazoXs3cXFdcRTsA7qQC7hIeIim3bLvxVASveraY8BsA1 vRQ5EeCH13uFBrvJLoelriolmM4T8FFtaiCDnplq+OoqB4qyhrqwn/aWlIukAwM7QmAoyx08jtT7 qqfy8g4JtwAGvU6ukc0blGhPCfle/M2/bDOzFu+RQOEalkWpBwOk6388MxGJTfVDymt3gkf0/Hor kFhBfmjgkskCN8U4S/8+HbCqsjQTbvep0itMd8dneBuDV4YA+vyWaP/mAsX7pxmqJo0fxQ17qpos U9asqB3MBCioj7TesrxFWKX0ELlB4cfmd+dLyQzoWHAzbZWGmTxTVY7iTX0VBbnf+1wmxLuXi0hl 2oZSYCi4JDq502qru6Fw== From: 835703180@qq.com To: harry.van.haaren@intel.com Cc: dev@dpdk.org, Shiqi Liu <835703180@qq.com> Subject: [PATCH] examples/eventdev: Check for the NULL pointer after calling rte_zmalloc Date: Wed, 6 Jul 2022 15:23:15 +0800 X-OQ-MSGID: <20220706072314.1522-1-835703180@qq.com> X-Mailer: git-send-email 2.35.1.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Shiqi Liu <835703180@qq.com> As the possible failure of the rte_zmalloc(), the not_checked and checked could be NULL pointer. Therefore, it should be better to check it in order to avoid the dereference of the NULL pointer. Fixes: fa8054c8c88 ("examples/eventdev: add thread safe Tx worker pipeline") Signed-off-by: Shiqi Liu <835703180@qq.com> --- examples/eventdev_pipeline/pipeline_worker_tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c index a82e064c1c..6ea676c516 100644 --- a/examples/eventdev_pipeline/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline/pipeline_worker_tx.c @@ -764,7 +764,9 @@ init_adapters(uint16_t nb_ports) ret = rte_event_dev_info_get(evdev_id, &dev_info); adptr_services = rte_zmalloc(NULL, sizeof(struct rx_adptr_services), 0); - + if (adptr_services == NULL) { + return -ENOMEM; + } struct rte_event_port_conf adptr_p_conf = { .dequeue_depth = cdata.worker_cq_depth, .enqueue_depth = 64, -- 2.35.1.windows.2