From b1d4218a518f1c7e2cf1e509880f828f272c0194 Mon Sep 17 00:00:00 2001 From: fanwang2 Date: Fri, 10 Jul 2015 09:01:42 +0000 Subject: 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 Reviewed-by: Ye Ting Reviewed-by: Jiaxin Wu git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17924 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c | 8 ++++---- 1 file 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 . // -- cgit v1.2.3