From: "Ni, Ray" <ray.ni@intel.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Oliver Steffen <osteffen@redhat.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>,
Pawel Polawski <ppolawsk@redhat.com>,
"Dong, Eric" <eric.dong@intel.com>
Subject: Re: [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling
Date: Wed, 22 Mar 2023 01:55:06 +0000 [thread overview]
Message-ID: <MN6PR11MB8244937EFC7FED8F245C7FF98C869@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230310124849.831839-3-kraxel@redhat.com>
Just found "if (!Buffer)" doesn't follow EDK2 coding style.
I changed to "if (Buffer == NULL) {" in final merge PR.
> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Friday, March 10, 2023 8:49 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Oliver Steffen <osteffen@redhat.com>;
> Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>; Pawel Polawski <ppolawsk@redhat.com>; Dong,
> Eric <eric.dong@intel.com>
> Subject: [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling
>
> ASSERT() is not proper handling of allocation failures, it gets compiled
> out on RELEASE builds. Print a message and enter dead loop instead.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> index 55a9f79da8eb..2e41df1f1074 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> @@ -879,6 +879,12 @@ PiCpuSmmEntry (
> //
> BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize *
> (mMaxNumberOfCpus - 1));
> Buffer = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
> + if (!Buffer) {
> + DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages));
> + CpuDeadLoop ();
> + return EFI_OUT_OF_RESOURCES;
> + }
> +
> ASSERT (Buffer != NULL);
> DEBUG ((DEBUG_INFO, "New Allcoated SMRAM SaveState Buffer (0x%08x,
> 0x%08x)\n", Buffer, EFI_PAGES_TO_SIZE (BufferPages)));
> }
> --
> 2.39.2
prev parent reply other threads:[~2023-03-22 1:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 12:48 [PATCH 0/2] UefiCpuPkg/PiSmmCpuDxeSmm: drop support for obsolete processors, fix error handling Gerd Hoffmann
2023-03-10 12:48 ` [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: drop support for obsolete processors Gerd Hoffmann
2023-03-20 10:04 ` Ni, Ray
2023-03-10 12:48 ` [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling Gerd Hoffmann
2023-03-20 10:04 ` Ni, Ray
2023-03-22 1:55 ` Ni, Ray [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=MN6PR11MB8244937EFC7FED8F245C7FF98C869@MN6PR11MB8244.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