summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-10-31 12:07:31 +0800
committerJiewen Yao <jiewen.yao@intel.com>2017-10-31 12:07:31 +0800
commitb0489b8f3f276932db8aa7af3680b41574bb09f3 (patch)
tree5c7785e197e531e7d3ed2307d3982601e1279343 /Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
parent055bedd1c45770e73a7d2a60b11657af62535c7a (diff)
downloadedk2-platforms-b0489b8f3f276932db8aa7af3680b41574bb09f3.tar.xz
Add NULL check for GetPciSegmentInfo()
Suggested-by: Michael A Kubacki <michael.a.kubacki@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c')
-rw-r--r--Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
index a7e09f16b8..1facc63d01 100644
--- a/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
+++ b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
@@ -44,6 +44,10 @@ GetPciSegmentInfo (
VOID *Hob;
PCI_SEGMENT_INFO *PciSegmentInfo;
+ if (Count == NULL) {
+ return NULL;
+ }
+
*Count = 1;
Hob = GetFirstGuidHob (&mPciSegmentInfoHobGuid);
if (Hob != NULL) {
@@ -51,6 +55,9 @@ GetPciSegmentInfo (
} else {
PciSegmentInfo = BuildGuidHob (&mPciSegmentInfoHobGuid, sizeof(PCI_SEGMENT_INFO));
ASSERT(PciSegmentInfo != NULL);
+ if (PciSegmentInfo == NULL) {
+ return NULL;
+ }
PciSegmentInfo->SegmentNumber = 0;
PciSegmentInfo->BaseAddress = PcdGet64(PcdPciExpressBaseAddress);
PciSegmentInfo->StartBusNumber = 0;