From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 90C4F2219BC99 for ; Wed, 20 Dec 2017 23:34:26 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 23:39:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="14099955" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 20 Dec 2017 23:39:14 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Dec 2017 23:39:14 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Dec 2017 23:39:13 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Thu, 21 Dec 2017 15:39:12 +0800 From: "Fu, Siyuan" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Wang, Fan" , "Ye, Ting" Thread-Topic: [Patch] MdeModulePkg/SnpDxe: Check the value of Nii->Id before use it directly. Thread-Index: AQHTeisd9XkZRnL6aEKK64bAEB70O6NNaOVw Date: Thu, 21 Dec 2017 07:39:11 +0000 Message-ID: References: <1513840360-12740-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1513840360-12740-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWNiNTUyY2UtNmUyYy00MTM5LTk2YWMtYTY5MDFmODczZjg3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJqTDkwRE04dVpaMzE2TlJQQmpnekVxbXl0ZGsrZGJWcnhPdThpNEZoTzk4M296TGlOXC9UcmR4YlE5b2Vjc3diTCJ9 dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Thu, 21 Dec 2017 07:34:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Jiaxin In the line you are modifying the UDNI is always not started. You should mo= ve the Nii->Id to the line after PxeStart(), not to check it here. BestRegards Fu Siyuan > -----Original Message----- > From: Wu, Jiaxin > Sent: Thursday, December 21, 2017 3:13 PM > To: edk2-devel@lists.01.org > Cc: Wang, Fan ; Ye, Ting ; Fu, > Siyuan ; Wu, Jiaxin > Subject: [Patch] MdeModulePkg/SnpDxe: Check the value of Nii->Id before > use it directly. >=20 > 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. >=20 > 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(-) >=20 > diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c > b/MdeModulePkg/Universal/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; > -- > 1.9.5.msysgit.1