public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/PiSmmCore: add API parameter check
@ 2018-02-06  5:14 Jian J Wang
  2018-02-06  6:59 ` Zeng, Star
  0 siblings, 1 reply; 2+ messages in thread
From: Jian J Wang @ 2018-02-06  5:14 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Eric Dong

The Heap Guard feature wrapped SmmInternalFreePagesEx with
SmmInternalFreePagesExWithGuard but didn't add necessary
parameter check. This patch fixes this situation.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
index 063a330b18..c5ffb26342 100644
--- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
+++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
@@ -1205,6 +1205,10 @@ SmmInternalFreePagesExWithGuard (
   EFI_PHYSICAL_ADDRESS    MemoryToFree;
   UINTN                   PagesToFree;
 
+  if (((Memory & EFI_PAGE_MASK) != 0) || (Memory == 0) || (NumberOfPages == 0)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   MemoryToFree  = Memory;
   PagesToFree   = NumberOfPages;
 
-- 
2.14.1.windows.1



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

* Re: [PATCH] MdeModulePkg/PiSmmCore: add API parameter check
  2018-02-06  5:14 [PATCH] MdeModulePkg/PiSmmCore: add API parameter check Jian J Wang
@ 2018-02-06  6:59 ` Zeng, Star
  0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2018-02-06  6:59 UTC (permalink / raw)
  To: Wang, Jian J, edk2-devel@lists.01.org; +Cc: Dong, Eric, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>


Thanks,
Star
-----Original Message-----
From: Wang, Jian J 
Sent: Tuesday, February 6, 2018 1:14 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: [PATCH] MdeModulePkg/PiSmmCore: add API parameter check

The Heap Guard feature wrapped SmmInternalFreePagesEx with SmmInternalFreePagesExWithGuard but didn't add necessary parameter check. This patch fixes this situation.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
index 063a330b18..c5ffb26342 100644
--- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
+++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
@@ -1205,6 +1205,10 @@ SmmInternalFreePagesExWithGuard (
   EFI_PHYSICAL_ADDRESS    MemoryToFree;
   UINTN                   PagesToFree;
 
+  if (((Memory & EFI_PAGE_MASK) != 0) || (Memory == 0) || (NumberOfPages == 0)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   MemoryToFree  = Memory;
   PagesToFree   = NumberOfPages;
 
--
2.14.1.windows.1



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

end of thread, other threads:[~2018-02-06  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06  5:14 [PATCH] MdeModulePkg/PiSmmCore: add API parameter check Jian J Wang
2018-02-06  6:59 ` Zeng, Star

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