From 4053587347a4c68402c1fc40921b7f1cdaec900e Mon Sep 17 00:00:00 2001 From: "Zeng, Star" Date: Fri, 9 Aug 2019 09:53:45 +0800 Subject: [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case 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. Signed-off-by: Star Zeng Reviewed-by: Hao A Wu --- .../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 eee30c852f..d4245465ce 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.39.2