public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
@ 2016-08-02  5:38 Liming Gao
  2016-08-02  7:11 ` Tian, Feng
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2016-08-02  5:38 UTC (permalink / raw)
  To: edk2-devel

Check NULL pointer before access it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
index 9eea50d..18a07d8 100644
--- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -345,6 +345,9 @@ FvNotificationEvent (
   Index      = 0;
   BufferSize = sizeof (EFI_HANDLE);
   Handle     = AllocateZeroPool (BufferSize);
+  if (Handle == NULL) {
+    return;
+  }
   Status = gBS->LocateHandle (
                     ByProtocol,
                     &gEfiFirmwareVolume2ProtocolGuid,
@@ -355,6 +358,9 @@ FvNotificationEvent (
   if (EFI_BUFFER_TOO_SMALL == Status) {
     FreePool (Handle);
     Handle = AllocateZeroPool (BufferSize);
+    if (Handle == NULL) {
+      return;
+    }
     Status = gBS->LocateHandle (
                     ByProtocol,
                     &gEfiFirmwareVolume2ProtocolGuid,
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
  2016-08-02  5:38 [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access Liming Gao
@ 2016-08-02  7:11 ` Tian, Feng
  0 siblings, 0 replies; 2+ messages in thread
From: Tian, Feng @ 2016-08-02  7:11 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org; +Cc: Tian, Feng

Reviewed-by: Feng Tian <feng.tian@intel.com>

Thanks
Feng

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Tuesday, August 2, 2016 1:39 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access

Check NULL pointer before access it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
index 9eea50d..18a07d8 100644
--- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -345,6 +345,9 @@ FvNotificationEvent (
   Index      = 0;
   BufferSize = sizeof (EFI_HANDLE);
   Handle     = AllocateZeroPool (BufferSize);
+  if (Handle == NULL) {
+    return;
+  }
   Status = gBS->LocateHandle (
                     ByProtocol,
                     &gEfiFirmwareVolume2ProtocolGuid, @@ -355,6 +358,9 @@ FvNotificationEvent (
   if (EFI_BUFFER_TOO_SMALL == Status) {
     FreePool (Handle);
     Handle = AllocateZeroPool (BufferSize);
+    if (Handle == NULL) {
+      return;
+    }
     Status = gBS->LocateHandle (
                     ByProtocol,
                     &gEfiFirmwareVolume2ProtocolGuid,
--
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-02  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02  5:38 [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access Liming Gao
2016-08-02  7:11 ` Tian, Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox