Looks good. Reviewed-by: Ye Ting <ting...@intel.com> -----Original Message----- From: Wang Fan [mailto:fan.w...@intel.com] Sent: Friday, July 10, 2015 4:19 PM To: Wu, Jiaxin; Fu, Siyuan; edk2-devel@lists.sourceforge.net Subject: [edk2] [Patch 2/2] 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.w...@intel.com> --- 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 27dae58..381dcb1 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c @@ -872,10 +872,14 @@ Ip4FormExtractConfig ( EFI_STRING ConfigRequest; BOOLEAN AllocatedRequest; EFI_STRING FormResult; UINTN Size; UINTN BufferSize; + + if (Progress == NULL || Results == NULL) { + return EFI_INVALID_PARAMETER; + } Status = EFI_SUCCESS; IfrFormNvData = NULL; ConfigRequest = NULL; FormResult = NULL; @@ -885,14 +889,10 @@ Ip4FormExtractConfig ( Private = IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(This); Ip4Config2Instance = IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Private); BufferSize = sizeof (IP4_CONFIG2_IFR_NVDATA); *Progress = Request; - if (Progress == NULL || Results == NULL) { - return EFI_INVALID_PARAMETER; - } - // // Check Request data in <ConfigHdr>. // if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) { IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG2_IFR_NVDATA)); -- 1.9.5.msysgit.1 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel