public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: NumberOfCpus may be uninitialized
Date: Thu, 21 Jan 2021 14:44:48 +0000	[thread overview]
Message-ID: <DM6PR11MB4058A330A919B62168A6BA59E3A19@DM6PR11MB4058.namprd11.prod.outlook.com> (raw)
In-Reply-To: <739d840f-eacb-c76d-1342-3457e6775d67@redhat.com>

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Thursday, January 21, 2021 10:38 PM
> To: devel@edk2.groups.io; Zeng, Star <star.zeng@intel.com>
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg RegisterCpuFeaturesLib:
> NumberOfCpus may be uninitialized
> 
> On 01/21/21 10:39, Zeng, Star wrote:
> > NumberOfCpus local variable in GetAcpiCpuData will be uninitialized
> > when CpuS3DataDxe runs before DxeRegisterCpuFeaturesLib (linked by
> > CpuFeaturesDxe) because there is no code to initialize it at
> > (AcpiCpuData != NULL) execution path.
> >
> > The issue is exposed after cefad282fb31aff3e1a6dcbd368cbbffc3fce900
> > and 38ee7bafa72f58982f99ac6f61eef160f80bad69.
> > There was negligence in that code review.
> > One further topic may be "Could EDK2 CI be enhanced to catch this kind
> > of uninitialized local variable case?". :)
> >
> > This patch fixes this regression issue.
> >
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Signed-off-by: Star Zeng <star.zeng@intel.com>
> > ---
> >  .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c      | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git
> > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> > index 7bb92404027f..60daa5cc87f0 100644
> > ---
> > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib
> > +++ .c
> > @@ -957,6 +957,7 @@ GetAcpiCpuData (
> >      //
> >      // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable
> for all CPUs
> >      //
> > +    NumberOfCpus = AcpiCpuData->NumberOfCpus;
> >      TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
> >      RegisterTable  = AllocatePages (EFI_SIZE_TO_PAGES (TableSize));
> >      ASSERT (RegisterTable != NULL);
> >
> 
> Merged as commit 6c5801be6ef3, via
> <https://github.com/tianocore/edk2/pull/1380>.
> 
> I've picked up Ray's R-b from the detached message
> <https://edk2.groups.io/g/devel/message/70615>.
> 
> I've also updated the original ticket:
> <https://bugzilla.tianocore.org/show_bug.cgi?id=3159>.
> 
> Thanks & sorry about the regression,
> Laszlo

No worry, it was my negligence for the original code review series.
Fortunately, we catch it quickly. 😊

Star


      reply	other threads:[~2021-01-21 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  9:39 [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: NumberOfCpus may be uninitialized Zeng, Star
2021-01-21 13:47 ` [edk2-devel] " Laszlo Ersek
2021-01-21 14:32   ` Zeng, Star
2021-01-21 14:38 ` Laszlo Ersek
2021-01-21 14:44   ` Zeng, Star [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=DM6PR11MB4058A330A919B62168A6BA59E3A19@DM6PR11MB4058.namprd11.prod.outlook.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