From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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 A7D79221ED77E for ; Wed, 20 Dec 2017 23:54:38 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 23:59:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="160642982" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2017 23:59:26 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Dec 2017 23:59:26 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 20 Dec 2017 23:59:25 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Thu, 21 Dec 2017 15:59:25 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "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: AQHTeisdN8LKrUpr4ki0IeJ0//uqnaNM4yKAgACILcA= Date: Thu, 21 Dec 2017 07:59:24 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274163558BF@SHSMSX103.ccr.corp.intel.com> References: <1513840360-12740-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWNiNTUyY2UtNmUyYy00MTM5LTk2YWMtYTY5MDFmODczZjg3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InVwbitzUjJTSlhcL0FkR2ZQUURaSnBCRFJSTndzblVoU1pVUStQWWhvR1pzPSJ9 x-ctpclassification: CTP_IC 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:54:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks to catch that. The UNDI is started by SNP driver. Then, Nii->Id cha= nges to the none-zero value. But currently, UNDI seems not follow that. =20 > -----Original Message----- > From: Fu, Siyuan > Sent: Thursday, December 21, 2017 3:39 PM > To: Wu, Jiaxin ; edk2-devel@lists.01.org > Cc: Wang, Fan ; Ye, Ting > Subject: RE: [Patch] MdeModulePkg/SnpDxe: Check the value of Nii->Id > before use it directly. >=20 > Hi, Jiaxin >=20 > In the line you are modifying the UDNI is always not started. You should > move the Nii->Id to the line after PxeStart(), not to check it here. >=20 > BestRegards > Fu Siyuan >=20 > > -----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. > > > > Nii->Id is the address of the first byte of the identifying structure > > for this network interface. This is only valid when the network interfa= ce > > is started. When the network interface is not started, this field is se= t > > to zero. So, we should check the value of Nii->Id before use it directl= y. > > > > 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/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. > > > > -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 fou= nd > > at > > http://opensource.org/licenses/bsd-license.php > > > > @@ -333,10 +333,15 @@ SimpleNetworkDriverStart ( > > return Status; > > } > > > > DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n")); > > > > + if (Nii->Id =3D=3D 0) { > > + DEBUG ((EFI_D_NET, "\nUNDI is not started.\n")); > > + goto NiiError; > > + } > > + > > Pxe =3D (PXE_UNDI *) (UINTN) (Nii->Id); > > > > 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