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 D902341EB5; Thu, 16 Mar 2023 22:30:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F04C742FC0; Thu, 16 Mar 2023 22:29:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E69EF42DB3 for ; Thu, 16 Mar 2023 22:29:39 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32GFtBbf005959 for ; Thu, 16 Mar 2023 14:29:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=iIHXzG4GEpm43KLVSmNx67XKj1eDduAVcsjwqi+qlrw=; b=OB7Pu3e5mNg10OpOU5Vl2nu+dIbTiMgUJdkXX2irAZWlM49UG6HXPgVioxvJRpINVZCM ptb9ySOxHoxF8DS1cvflSi6exUla1a5ga2IJAHnmExNZcf7ejkrQKL8zMGgVfy11s4VC dCmpFnkRyuLOdTjgaTSldZzS5hoCWtlNF71KWlJQKqXbDB2xwV1BzUChgkC5gqAlELzA mdq6n6jTjr3O/Z6wrSlA3EZX34SDLzCG52Mswnu7uiEGpPEw+eBKTp5y4Bxyvkn9Q6yn KVeQ5/YcFG97jMl0uLIjta3doxRy0CixuyTQPvOJs+JcdxOxiNVXkmYAz+dQ9fOlcmr8 tg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pbxq2ucrk-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Mar 2023 14:29:39 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 16 Mar 2023 14:29:36 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 16 Mar 2023 14:29:36 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 2959A3F7063; Thu, 16 Mar 2023 14:29:36 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi , Prince Takkar CC: , , , Subject: [PATCH v3 6/8] ml/cnxk: check for null pointer before dereference Date: Thu, 16 Mar 2023 14:29:02 -0700 Message-ID: <20230316212904.9318-7-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230316212904.9318-1-syalavarthi@marvell.com> References: <20230315135427.11489-1-syalavarthi@marvell.com> <20230316212904.9318-1-syalavarthi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: FEjzqWcmCzKrE36btOW0IH0cOjj1qP1E X-Proofpoint-ORIG-GUID: FEjzqWcmCzKrE36btOW0IH0cOjj1qP1E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_14,2023-03-16_02,2023-02-09_01 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 Fix deference before null check. Issue reported by coverity scan. Coverity issue: 383665 Fixes: 817e3e55bb18 ("ml/cnxk: support simulator environment") Signed-off-by: Srikanth Yalavarthi --- drivers/ml/cnxk/cn10k_ml_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ml/cnxk/cn10k_ml_dev.c b/drivers/ml/cnxk/cn10k_ml_dev.c index 6f9a1015a6..bba3c9022e 100644 --- a/drivers/ml/cnxk/cn10k_ml_dev.c +++ b/drivers/ml/cnxk/cn10k_ml_dev.c @@ -779,8 +779,8 @@ cn10k_ml_fw_load(struct cn10k_ml_dev *mldev) if (roc_env_is_emulator() || roc_env_is_hw()) { /* Read firmware image to a buffer */ ret = rte_firmware_read(fw->path, &fw_buffer, &fw_size); - if (ret < 0) { - plt_err("Can't read firmware data: %s\n", fw->path); + if ((ret < 0) || (fw_buffer == NULL)) { + plt_err("Unable to read firmware data: %s\n", fw->path); return ret; } -- 2.17.1