From: "Zeng, Star" <star.zeng@intel.com>
To: devel@edk2.groups.io
Cc: Star Zeng <star.zeng@intel.com>, Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case
Date: Fri, 9 Aug 2019 09:53:45 +0800 [thread overview]
Message-ID: <20190809015345.63500-1-star.zeng@intel.com> (raw)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2051
Original code GetConfigTable for AddrPtr first, if failed,
InstalConfigTable with allocated AddrPtr. So the AddrPtr
should not be NULL and the NULL pointer dereference case
should be false positive. This patch is just to address
the case raised from static analysis.
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
.../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
index eee30c852ffd..d4245465ce74 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c
@@ -447,7 +447,7 @@ DebugCommunicationUsb3DxeConstructor (
EFI_EVENT Event;
Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &AddrPtr);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || (AddrPtr == NULL)) {
//
// Instead of using local variables, install system configuration table for
// the local instance and the buffer to save instance address pointer.
--
2.21.0.windows.1
next reply other threads:[~2019-08-09 1:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 1:53 Zeng, Star [this message]
2019-08-12 1:48 ` [edk2-devel] [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case Wu, Hao A
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=20190809015345.63500-1-star.zeng@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