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.24; helo=mga09.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 392002194D387 for ; Thu, 18 Oct 2018 07:38:01 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2018 07:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,396,1534834800"; d="scan'208";a="272404919" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 18 Oct 2018 07:38:00 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 18 Oct 2018 07:38:00 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 18 Oct 2018 07:38:00 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.111]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.183]) with mapi id 14.03.0319.002; Thu, 18 Oct 2018 22:37:57 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd Thread-Index: AQHUZu51RWZOwGTNt0Ohw+Itdxy9aqUki+AAgACGcvA= Date: Thu, 18 Oct 2018 14:37:56 +0000 Message-ID: References: <1539872727-8316-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 14:38:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. Thanks for the comment. I will update it when push it. Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Thursday, October 18, 2018 10:36 PM To: Zhu, Yonghong ; edk2-devel@lists.01.org Subject: RE: [edk2] [Patch] BaseTools: Fix one crash bug in the report for = Fixed structure Pcd Reviewed-by: Jaben Carsey Note that you could change your first 2 lines (of the new content in both p= laces) to: for Data in OverrideValues.values(): since you don't ever use the key later on... -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Yonghong Zhu > Sent: Thursday, October 18, 2018 7:25 AM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch] BaseTools: Fix one crash bug in the report for=20 > Fixed structure Pcd >=20 > The case is: > in the DSC file: > SKUID_IDENTIFIER =3D ALL >=20 > [SkuIds] > 0|DEFAULT > 1|A >=20 > [PcdsFixedAtBuild.common.A] > TokenSpaceGuid.Test401|{0x0F, 0x12} > TokenSpaceGuid.Test401.TEST401INT8ARRAY[0]|'B' >=20 > in the build report, Data =3D OverrideValues[Keys[0]], but the Keys[0]=20 > is the keyword "DEFAULT", and in this case the "DEFAULT" SKU doesn't=20 > save any value, then it cause the Data is empty, in the next code when=20 > we use the code it cause crash. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/build/BuildReport.py | 23=20 > +++++++++++++-------- > -- > 1 file changed, 13 insertions(+), 10 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/build/BuildReport.py > b/BaseTools/Source/Python/build/BuildReport.py > index 14143b3..5e2a664 100644 > --- a/BaseTools/Source/Python/build/BuildReport.py > +++ b/BaseTools/Source/Python/build/BuildReport.py > @@ -1089,14 +1089,16 @@ class PcdReport(object): > DscOverride =3D False > else: > if not Pcd.SkuInfoList: > OverrideValues =3D Pcd.SkuOverrideVa= lues > if OverrideValues: > - Keys =3D list(OverrideValues.key= s()) > - Data =3D OverrideValues[Keys[0]] > - Struct =3D list(Data.values()) > - DscOverride =3D self.ParseStruct= (Struct[0]) > + for key in OverrideValues.keys()= : > + Data =3D OverrideValues[key] > + Struct =3D list(Data.values(= )) > + if Struct: > + DscOverride =3D self.Par= seStruct(Struct[0]) > + break > else: > SkuList =3D sorted(Pcd.SkuInfoList.k= eys()) > for Sku in SkuList: > SkuInfo =3D Pcd.SkuInfoList[Sku] > if TypeName in ('DYNHII', 'DEXHI= I'): > @@ -1265,16 +1267,17 @@ class PcdReport(object): > Value =3D "0x{:X} ({})".format(int(Value, 0), Va= lue) > FileWrite(File, ' %-*s : %6s %10s =3D %s' % (self.MaxL= en, Flag + ' ' + > PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) > if IsStructure: > OverrideValues =3D Pcd.SkuOverrideValues > if OverrideValues: > - Keys =3D list(OverrideValues.keys()) > - Data =3D OverrideValues[Keys[0]] > - Struct =3D list(Data.values()) > - if Struct: > - OverrideFieldStruct =3D self.OverrideFieldValue(= Pcd, Struct[0]) > - self.PrintStructureInfo(File, OverrideFieldStruc= t) > + for key in OverrideValues.keys(): > + Data =3D OverrideValues[key] > + Struct =3D list(Data.values()) > + if Struct: > + OverrideFieldStruct =3D self.OverrideFieldVa= lue(Pcd, Struct[0]) > + self.PrintStructureInfo(File, OverrideFieldS= truct) > + break > self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch,=20 > DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) > else: > FirstPrint =3D True > SkuList =3D sorted(Pcd.SkuInfoList.keys()) > for Sku in SkuList: > -- > 2.6.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel