From: "Ranbir Singh" <Ranbir.Singh3@Dell.com>
To: devel@edk2.groups.io
Subject: [PATCH] SecurityPkg/Tcg/Tcg2Config: Fix REVERSE_INULL Coverity issue
Date: Wed, 04 Jan 2023 02:50:11 -0800 [thread overview]
Message-ID: <MI95.1672829411506179868.2gWP@groups.io> (raw)
[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]
The function Tcg2ConfigDriverEntryPoint at the point of creating a
private data structure makes a call to AllocateCopyPool and stores
the return value in PrivateData. Thereafter it does a check
ASSERT (PrivateData != NULL);
but this is applicable only in DEBUG mode. In Release mode, the code
continues further and will dereference "PrivateData" which will lead
to CRASH if PrivateData is NULL.
Hence, for safety add PrivateData NULL pointer check and return from
there saying EFI_OUT_OF_RESOURCES when PrivateData is NULL.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4229
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
---
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
index edf5f0fc77..f023b3ccb8 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
@@ -283,6 +283,10 @@ Tcg2ConfigDriverEntryPoint (
//
PrivateData = AllocateCopyPool (sizeof (TCG2_CONFIG_PRIVATE_DATA), &mTcg2ConfigPrivateDateTemplate);
ASSERT (PrivateData != NULL);
+ if (PrivateData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
mTcg2ConfigPrivateDate = PrivateData;
//
// Install private GUID.
--
2.36.1.windows.1
[-- Attachment #2: Type: text/html, Size: 1914 bytes --]
reply other threads:[~2023-01-04 10:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=MI95.1672829411506179868.2gWP@groups.io \
--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