summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe
diff options
context:
space:
mode:
authorfanwang2 <fan.wang@intel.com>2015-07-10 09:01:42 +0000
committerfanwang2 <fanwang2@Edk2>2015-07-10 09:01:42 +0000
commitb1d4218a518f1c7e2cf1e509880f828f272c0194 (patch)
tree9e373b31edc6636f84c9eae0c6ed5a191d4dee11 /MdeModulePkg/Universal/Network/Ip4Dxe
parent3fd7bd08f438130f9fcbcc1ab4392dea1a859c14 (diff)
downloadedk2-platforms-b1d4218a518f1c7e2cf1e509880f828f272c0194.tar.xz
MdeModulePkg: Code logic optimization for Ip4Dxe driver
Move null check before set value to address to avoid null address dereferenced. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: fanwang2 <fan.wang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17924 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
index 27dae58553..381dcb1e97 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
@@ -874,6 +874,10 @@ Ip4FormExtractConfig (
EFI_STRING FormResult;
UINTN Size;
UINTN BufferSize;
+
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
Status = EFI_SUCCESS;
IfrFormNvData = NULL;
@@ -887,10 +891,6 @@ Ip4FormExtractConfig (
BufferSize = sizeof (IP4_CONFIG2_IFR_NVDATA);
*Progress = Request;
- if (Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
//
// Check Request data in <ConfigHdr>.
//