public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Jiang, Guomin" <guomin.jiang@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Xu, Wei6" <wei6.xu@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Kun Qin <kuqin@microsoft.com>, "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH] FmpDevicePkg/FmpDxe: Fix uninitialized pointer dereference
Date: Mon, 23 Mar 2020 16:05:39 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B9EED836@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <B1F5B0856690F44595CF70FED755C9395494EB@SHSMSX101.ccr.corp.intel.com>

The BZ report indicates that an invalid point access
was observed.  Perhaps Sean can add the details in the BZ
for which line of code generated in invalid access.

https://bugzilla.tianocore.org/show_bug.cgi?id=2602

Mike

> -----Original Message-----
> From: Jiang, Guomin <guomin.jiang@intel.com>
> Sent: Monday, March 23, 2020 12:21 AM
> To: devel@edk2.groups.io; Kinney, Michael D
> <michael.d.kinney@intel.com>; Xu, Wei6
> <wei6.xu@intel.com>
> Cc: Kun Qin <kuqin@microsoft.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: RE: [edk2-devel] [PATCH] FmpDevicePkg/FmpDxe:
> Fix uninitialized pointer dereference
> 
> Hi Xuwei, QinKun,
> 
> Have you indeed encounter this issue or just think it
> is potential issue.
> 
> I think  below code will always initialize the
> mFmpImageInfoBuf[] and make sure it is valid.
> Line 585 - mFmpImageInfoBuf[Index] = AllocateZeroPool
> (ImageInfoSize);
> 
> If the second GetImageInfo() is runned, I think it will
> always have correct mfmpImageInfoBuf[] address.
> 
> Of course, it is ok to use AllocateZeroPool to ensure
> zero buffer is allocated.
> 
> Thanks
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> > Michael D Kinney
> > Sent: Wednesday, March 18, 2020 11:15 PM
> > To: Xu, Wei6 <wei6.xu@intel.com>;
> devel@edk2.groups.io; Kinney, Michael
> > D <michael.d.kinney@intel.com>
> > Cc: Kun Qin <kuqin@microsoft.com>; Gao, Liming
> <liming.gao@intel.com>
> > Subject: Re: [edk2-devel] [PATCH]
> FmpDevicePkg/FmpDxe: Fix uninitialized
> > pointer dereference
> >
> > Reviewed-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> >
> > > -----Original Message-----
> > > From: Xu, Wei6 <wei6.xu@intel.com>
> > > Sent: Tuesday, March 17, 2020 11:12 PM
> > > To: devel@edk2.groups.io
> > > Cc: Kun Qin <kuqin@microsoft.com>; Kinney, Michael
> D
> > > <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> > > Subject: [edk2-devel] [PATCH] FmpDevicePkg/FmpDxe:
> Fix uninitialized
> > > pointer dereference
> > >
> > > From: Kun Qin <kuqin@microsoft.com>
> > >
> > > REF:
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=2602
> > >
> > > Zero the allocated buffer in case GetImageInfo
> `continue` in the
> > > middle of a loop. This will cause unexpected
> GetImageInfo failure not
> > > clearing the corresponding entry and lead to GP
> faults when
> > > dereferencing this entry.
> > >
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
> > > ---
> > >  FmpDevicePkg/FmpDxe/Dependency.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/FmpDevicePkg/FmpDxe/Dependency.c
> > > b/FmpDevicePkg/FmpDxe/Dependency.c
> > > index 8f97c42916..65c23989c6 100644
> > > --- a/FmpDevicePkg/FmpDxe/Dependency.c
> > > +++ b/FmpDevicePkg/FmpDxe/Dependency.c
> > > @@ -550,11 +550,11 @@ EvaluateImageDependencies (
> > >                  );
> > >    if (EFI_ERROR (Status)) {
> > >      return EFI_ABORTED;
> > >    }
> > >
> > > -  mFmpImageInfoBuf = AllocatePool
> > > (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) *
> > mNumberOfFmpInstance);
> > > +  mFmpImageInfoBuf = AllocateZeroPool
> > > (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) *
> > mNumberOfFmpInstance);
> > >    if (mFmpImageInfoBuf == NULL) {
> > >      return EFI_OUT_OF_RESOURCES;
> > >    }
> > >
> > >    for (Index = 0; Index < mNumberOfFmpInstance;
> Index
> > > ++) {
> > > --
> > > 2.16.2.windows.1
> >
> >
> > 


      parent reply	other threads:[~2020-03-23 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18  6:12 [edk2-devel] [PATCH] FmpDevicePkg/FmpDxe: Fix uninitialized pointer dereference Xu, Wei6
2020-03-18 15:15 ` Michael D Kinney
2020-03-23  7:21   ` Guomin Jiang
2020-03-23  7:40     ` Kun Qin
2020-03-23  8:12       ` Guomin Jiang
     [not found]       ` <15FEE0ADB157EE06.9780@groups.io>
2020-05-06  1:35         ` Guomin Jiang
2020-05-06  3:17           ` Xu, Wei6
2020-03-23 16:05     ` Michael D Kinney [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=E92EE9817A31E24EB0585FDF735412F5B9EED836@ORSMSX113.amr.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