From patchwork Thu May 7 09:08:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh A P X-Patchwork-Id: 69909 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F915A00C5; Thu, 7 May 2020 10:52:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E1891DA8B; Thu, 7 May 2020 10:52:26 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 2327A1DA63 for ; Thu, 7 May 2020 10:52:25 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 3FB4229E703; Thu, 7 May 2020 01:52:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 3FB4229E703 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1588841543; bh=xjbtxecohtInYb4vSfmolHY8t3IYe14ReV5nH9L76Pk=; h=From:To:Cc:Subject:Date:From; b=FF0VpNoNRuWGyGQTXsUWgN4AHGzJgN74RkV28Kofct3/70ldIfwtmqpeV9bWZ5F/0 WHaeXQdI5rfkGLMCcy4n7Y7HvqZ8rhHbIWfM1go4FBDf3Wi45NojcsNLcd0oFo24A7 PvyOo4Le2kzhUeWwt6mQi2Fe5kYpUWgRLI6Xm6wE= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com Date: Thu, 7 May 2020 14:38:27 +0530 Message-Id: <20200507090827.27945-1-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue 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: Kalesh AP Note that the issue was observed in an internal Coverity scan. Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP profiles") Cc: stable@dpdk.org Signed-off-by: Kalesh AP --- app/test-pmd/cmdline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b040630..996a498 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed( #ifdef RTE_LIBRTE_I40E_PMD size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4; p_list = (struct rte_pmd_i40e_profile_list *)malloc(size); - if (!p_list) + if (!p_list) { printf("%s: Failed to malloc buffer\n", __func__); + return; + } if (ret == -ENOTSUP) ret = rte_pmd_i40e_get_ddp_list(res->port_id,