public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Carsey, Jaben" <jaben.carsey@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd
Date: Thu, 18 Oct 2018 14:37:56 +0000	[thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D52142DDB@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <CB6E33457884FA40993F35157061515CA416A0C4@FMSMSX103.amr.corp.intel.com>

Yes. Thanks for the comment. I will update it when push it.

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Carsey, Jaben 
Sent: Thursday, October 18, 2018 10:36 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; 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 <jaben.carsey@intel.com>

Note that you could change your first 2 lines (of the new content in both places) 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 
> 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 
> Fixed structure Pcd
> 
> The case is:
> in the DSC file:
> SKUID_IDENTIFIER               = ALL
> 
> [SkuIds]
>   0|DEFAULT
>   1|A
> 
> [PcdsFixedAtBuild.common.A]
>   TokenSpaceGuid.Test401|{0x0F, 0x12}
>   TokenSpaceGuid.Test401.TEST401INT8ARRAY[0]|'B'
> 
> in the build report, Data = OverrideValues[Keys[0]], but the Keys[0] 
> is the keyword "DEFAULT", and in this case the "DEFAULT" SKU doesn't 
> save any value, then it cause the Data is empty, in the next code when 
> we use the code it cause crash.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Source/Python/build/BuildReport.py | 23 
> +++++++++++++--------
> --
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> 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 = False
>                              else:
>                                  if not Pcd.SkuInfoList:
>                                      OverrideValues = Pcd.SkuOverrideValues
>                                      if OverrideValues:
> -                                        Keys = list(OverrideValues.keys())
> -                                        Data = OverrideValues[Keys[0]]
> -                                        Struct = list(Data.values())
> -                                        DscOverride = self.ParseStruct(Struct[0])
> +                                        for key in OverrideValues.keys():
> +                                            Data = OverrideValues[key]
> +                                            Struct = list(Data.values())
> +                                            if Struct:
> +                                                DscOverride = self.ParseStruct(Struct[0])
> +                                                break
>                                  else:
>                                      SkuList = sorted(Pcd.SkuInfoList.keys())
>                                      for Sku in SkuList:
>                                          SkuInfo = Pcd.SkuInfoList[Sku]
>                                          if TypeName in ('DYNHII', 'DEXHII'):
> @@ -1265,16 +1267,17 @@ class PcdReport(object):
>                          Value = "0x{:X} ({})".format(int(Value, 0), Value)
>                  FileWrite(File, ' %-*s   : %6s %10s = %s' % (self.MaxLen, Flag + ' ' +
> PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
>              if IsStructure:
>                  OverrideValues = Pcd.SkuOverrideValues
>                  if OverrideValues:
> -                    Keys = list(OverrideValues.keys())
> -                    Data = OverrideValues[Keys[0]]
> -                    Struct = list(Data.values())
> -                    if Struct:
> -                        OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
> -                        self.PrintStructureInfo(File, OverrideFieldStruct)
> +                    for key in OverrideValues.keys():
> +                        Data = OverrideValues[key]
> +                        Struct = list(Data.values())
> +                        if Struct:
> +                            OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
> +                            self.PrintStructureInfo(File, OverrideFieldStruct)
> +                            break
>              self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, 
> DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
>          else:
>              FirstPrint = True
>              SkuList = sorted(Pcd.SkuInfoList.keys())
>              for Sku in SkuList:
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2018-10-18 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 14:25 [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd Yonghong Zhu
2018-10-18 14:36 ` Carsey, Jaben
2018-10-18 14:37   ` Zhu, Yonghong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D52142DDB@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox