From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.1034.1572418277238428357 for ; Tue, 29 Oct 2019 23:51:17 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 23:51:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,246,1569308400"; d="scan'208";a="203100168" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 29 Oct 2019 23:51:16 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 29 Oct 2019 23:51:16 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 29 Oct 2019 23:51:16 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by shsmsx102.ccr.corp.intel.com ([169.254.2.108]) with mapi id 14.03.0439.000; Wed, 30 Oct 2019 14:51:14 +0800 From: "Wu, Hao A" To: "Zhang, Shenglei" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] MdeModulePkg/Variable/Pei: Update the condition in if statement Thread-Topic: [PATCH] MdeModulePkg/Variable/Pei: Update the condition in if statement Thread-Index: AQHVhJm4b0596qgRX0qKDZZnCedjQady01XQ Date: Wed, 30 Oct 2019 06:51:14 +0000 Message-ID: References: <20191017031935.19796-1-shenglei.zhang@intel.com> In-Reply-To: <20191017031935.19796-1-shenglei.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Zhang, Shenglei > Sent: Thursday, October 17, 2019 11:20 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A; Gao, Liming > Subject: [PATCH] MdeModulePkg/Variable/Pei: Update the condition in if > statement >=20 > IndexTable->Length is used as index in array IndexTable->Index[]. > So IndexTable->Length needs to be checked, which should be less than > the array size. >=20 > Cc: Hao A Wu > Cc: Liming Gao > Signed-off-by: Shenglei Zhang > --- > MdeModulePkg/Universal/Variable/Pei/Variable.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c > b/MdeModulePkg/Universal/Variable/Pei/Variable.c > index 715802f33c29..f61465fc3045 100644 > --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c > +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c > @@ -896,7 +896,7 @@ FindVariableEx ( > // > if ((IndexTable !=3D NULL) && !StopRecord) { > Offset =3D (UINTN) Variable - (UINTN) LastVariable; > - if ((Offset > 0x0FFFF) || (IndexTable->Length =3D=3D sizeof (Ind= exTable->Index) > / sizeof (IndexTable->Index[0]))) { > + if ((Offset > 0x0FFFF) || (IndexTable->Length >=3D sizeof (Index= Table- > >Index) / sizeof (IndexTable->Index[0]))) { Reviewed-by: Hao A Wu Best Regards, Hao Wu > // > // Stop to record if the distance of two neighbouring VAR_ADDE= D > variable is larger than the allowable scope(UINT16), > // or the record buffer is full. > -- > 2.18.0.windows.1