From nobody Sun May 19 02:07:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513840366967789.5013971628442; Wed, 20 Dec 2017 23:12:46 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5CE812219BC8F; Wed, 20 Dec 2017 23:07:57 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5ADFD221ED77E for ; Wed, 20 Dec 2017 23:07:56 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 23:12:44 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.141]) by orsmga002.jf.intel.com with ESMTP; 20 Dec 2017 23:12:42 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="20066166" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Thu, 21 Dec 2017 15:12:40 +0800 Message-Id: <1513840360-12740-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [Patch] MdeModulePkg/SnpDxe: Check the value of Nii->Id before use it directly. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Nii->Id is the address of the first byte of the identifying structure for this network interface. This is only valid when the network interface is started. When the network interface is not started, this field is set to zero. So, we should check the value of Nii->Id before use it directly. Cc: Wang Fan Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- MdeModulePkg/Universal/Network/SnpDxe/Snp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Uni= versal/Network/SnpDxe/Snp.c index 9f61aee..f0257a2 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c @@ -1,9 +1,9 @@ /** @file Implementation of driver entry point and driver binding protocol. =20 -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php =20 @@ -333,10 +333,15 @@ SimpleNetworkDriverStart ( return Status; } =20 DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n")); =20 + if (Nii->Id =3D=3D 0) { + DEBUG ((EFI_D_NET, "\nUNDI is not started.\n")); + goto NiiError; + } + Pxe =3D (PXE_UNDI *) (UINTN) (Nii->Id); =20 if (Calc8BitCksum (Pxe, Pxe->hw.Len) !=3D 0) { DEBUG ((EFI_D_NET, "\n!PXE checksum is not correct.\n")); goto NiiError; --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel