From 523f48e771b1088c6e2cfddc5c56cde1ef9a2ab0 Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 26 Jun 2014 03:24:25 +0000 Subject: [PATCH] Refine code to make it more safely. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15598 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c | 3 ++- MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 6 ++++-- MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c | 3 ++- MdeModulePkg/Core/Pei/Dependency/Dependency.c | 4 ++-- MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c | 2 +- MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 1 + MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 4 +++- MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 9 ++++++++- MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 4 +++- MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 3 ++- MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c | 2 ++ MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 1 + MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 3 ++- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c | 3 ++- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 3 ++- MdeModulePkg/Universal/Network/SnpDxe/Snp.c | 6 +++--- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 1 + .../PlatformDriOverrideDxe/PlatDriOverrideDxe.c | 7 ++++--- MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 4 +++- MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c | 4 ++++ MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 3 +++ 21 files changed, 55 insertions(+), 21 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c b/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c index cc9b06aa9b..d638ebaeb9 100644 --- a/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c +++ b/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c @@ -3,7 +3,7 @@ PEIM to produce gEfiPeiVirtualBlockIoPpiGuid PPI for ATA controllers in the plat This PPI canl be consumed by PEIM which produce gEfiPeiDeviceRecoveryModulePpiGuid for Atapi CD ROM device. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -1442,6 +1442,7 @@ Inquiry ( // prepare command packet for the ATAPI Inquiry Packet Command. // ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND)); + ZeroMem (&Idata, sizeof (ATAPI_INQUIRY_DATA)); Packet.Inquiry.opcode = ATA_CMD_INQUIRY; Packet.Inquiry.page_code = 0; diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c index 33f8c45d81..368b75d753 100644 --- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c +++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c @@ -2,7 +2,7 @@ PEIM to produce gPeiUsbHostControllerPpiGuid based on gPeiUsbControllerPpiGuid which is used to enable recovery function from USB Drivers. -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -1047,11 +1047,13 @@ CreateFrameList ( if (Status != EFI_SUCCESS) { return EFI_OUT_OF_RESOURCES; } - + ASSERT (UhcDev->ConfigQH != NULL); + Status = CreateQH(UhcDev, &UhcDev->BulkQH); if (Status != EFI_SUCCESS) { return EFI_OUT_OF_RESOURCES; } + ASSERT (UhcDev->BulkQH != NULL); // //Set the corresponding QH pointer diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c index b5a0d874f0..f2c0dd5de4 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -1,7 +1,7 @@ /** @file Implements functions to read firmware file -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -447,6 +447,7 @@ FvReadFileSection ( if (EFI_ERROR (Status)) { return Status; } + ASSERT (FileBuffer != NULL); // // Check to see that the file actually HAS sections before we go any further. diff --git a/MdeModulePkg/Core/Pei/Dependency/Dependency.c b/MdeModulePkg/Core/Pei/Dependency/Dependency.c index d209b8d505..e71566b5a7 100644 --- a/MdeModulePkg/Core/Pei/Dependency/Dependency.c +++ b/MdeModulePkg/Core/Pei/Dependency/Dependency.c @@ -5,7 +5,7 @@ if a driver can be scheduled for execution. The criteria for schedulability is that the dependency expression is satisfied. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -106,7 +106,7 @@ PeimDispatchReadiness ( Iterator = DependencyExpression; - StackPtr = &EvalStack[0]; + StackPtr = EvalStack; while (TRUE) { diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 10eef05098..84c6c9af1f 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -388,7 +388,7 @@ SetPassword ( // // Get user input password // - Password = &PrivateData->Configuration.WhatIsThePassword2[0]; + Password = PrivateData->Configuration.WhatIsThePassword2; PasswordSize = sizeof (PrivateData->Configuration.WhatIsThePassword2); ZeroMem (Password, PasswordSize); diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 0011c53e6f..f5e054d265 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -4339,6 +4339,7 @@ HiiConfigRoutingRouteConfig ( ); } if (EFI_ERROR (Status)) { + ASSERT (AccessProgress != NULL); // // AccessProgress indicates the parsing progress on . // Map it to the progress on then return it. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index 65334ded5e..01d7f02234 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -1,7 +1,7 @@ /** @file Implementation for EFI_HII_DATABASE_PROTOCOL. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -2419,6 +2419,7 @@ AddPackages ( // StringPkgIsAdd = FALSE; FontPackage = NULL; + StringPackage = NULL; // // Process the package list header @@ -2505,6 +2506,7 @@ AddPackages ( if (EFI_ERROR (Status)) { return Status; } + ASSERT (StringPackage != NULL); Status = InvokeRegisteredFunction ( Private, NotifyType, diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 24bb502996..eef31d5bb8 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_FONT_PROTOCOL. -Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1040,8 +1040,12 @@ IsSystemFontInfo ( return TRUE; } + SystemDefault = NULL; + DefaultLen = 0; + Status = GetSystemFont (Private, &SystemDefault, &DefaultLen); ASSERT_EFI_ERROR (Status); + ASSERT ((SystemDefault != NULL) && (DefaultLen != 0)); // // Record the system default info. @@ -1687,6 +1691,7 @@ HiiStringToImage ( SysFontFlag = IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfo, &SystemDefault, NULL); if (SysFontFlag) { + ASSERT (SystemDefault != NULL); FontInfo = NULL; Height = SystemDefault->FontInfo.FontSize; BaseLine = SystemDefault->FontInfo.FontSize; @@ -2580,6 +2585,7 @@ HiiGetGlyph ( Foreground = StringInfoOut->ForegroundColor; Background = StringInfoOut->BackgroundColor; } else { + ASSERT (SystemDefault != NULL); Foreground = SystemDefault->ForegroundColor; Background = SystemDefault->BackgroundColor; } @@ -2723,6 +2729,7 @@ HiiGetFontInfo ( return EFI_INVALID_PARAMETER; } + StringInfoOutLen = 0; FontInfo = NULL; SystemDefault = NULL; LocalFontHandle = NULL; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c index efa5bbb71b..ed0cf83c48 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_IMAGE_PROTOCOL. -Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1237,6 +1237,7 @@ HiiDrawImage ( return EFI_INVALID_PARAMETER; } + FontInfo = NULL; ImageIn = (EFI_IMAGE_INPUT *) Image; // @@ -1383,6 +1384,7 @@ HiiDrawImage ( FreePool (ImageOut); return Status; } + ASSERT (FontInfo != NULL); for (Index = 0; Index < Width * Height; Index++) { BltBuffer[Index] = FontInfo->BackgroundColor; } diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c index 19ad101d54..995bbcf840 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c @@ -1,7 +1,7 @@ /** @file EFI DHCP protocol implementation. -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -404,6 +404,7 @@ DhcpLeaseAcquired ( if (DhcpSb->Netmask == 0) { Class = NetGetIpClass (DhcpSb->ClientAddr); + ASSERT (Class < IP4_ADDR_CLASSE); DhcpSb->Netmask = gIp4AllMasks[Class << 3]; } diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c index a9c6df9db9..f8ae161b4c 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c @@ -227,6 +227,7 @@ IScsiUpdateDeviceList ( ); if (Status == EFI_BUFFER_TOO_SMALL) { DeviceList = (ISCSI_DEVICE_LIST *) AllocatePool (DataSize); + ASSERT (DeviceList != NULL); gRT->GetVariable ( L"iSCSIDeviceList", @@ -291,6 +292,7 @@ IScsiUpdateDeviceList ( // DeviceListSize = sizeof (ISCSI_DEVICE_LIST) + (NumHandles - 1) * sizeof (ISCSI_MAC_INFO); DeviceList = (ISCSI_DEVICE_LIST *) AllocatePool (DeviceListSize); + ASSERT (DeviceList != NULL); DeviceList->NumDevice = (UINT8) NumHandles; for (Index = 0; Index < NumHandles; Index++) { diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c index a00d805b84..1cb1fb89d9 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c @@ -219,6 +219,7 @@ IScsiLunToUnicodeStr ( TempStr += StrLen (TempStr); } + ASSERT (StrLen(Str) >= 1); Str[StrLen (Str) - 1] = 0; for (Index = StrLen (Str) - 1; Index > 1; Index = Index - 2) { diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c index e4ab17a37e..3c29f75f88 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c @@ -1,7 +1,7 @@ /** @file Implement IP4 pesudo interface. -Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -582,6 +582,7 @@ Ip4SetAddress ( Type = NetGetIpClass (IpAddr); Len = NetGetMaskLength (SubnetMask); + ASSERT (Len >= 1); Netmask = gIp4AllMasks[MIN ((Len - 1), Type << 3)]; Interface->NetBrdcast = (IpAddr | ~Netmask); diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c index ae157c5e0a..21547ee3af 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c @@ -1,7 +1,7 @@ /** @file Routines to process Rrq (download). -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -704,6 +704,7 @@ Mtftp4RrqInput ( } else { Packet = (EFI_MTFTP4_PACKET *) NetbufGetByte (UdpPacket, 0, NULL); + ASSERT (Packet != NULL); } Opcode = NTOHS (Packet->OpCode); diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c index 412c472e42..e825714700 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c @@ -1,7 +1,7 @@ /** @file Routines to process Wrq (upload). -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -398,6 +398,7 @@ Mtftp4WrqInput ( } else { Packet = (EFI_MTFTP4_PACKET *) NetbufGetByte (UdpPacket, 0, NULL); + ASSERT (Packet != NULL); } Opcode = NTOHS (Packet->OpCode); diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c index ed583b4888..ff93167767 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c @@ -1,7 +1,7 @@ /** @file Implementation of driver entry point and driver binding protocol. -Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -545,8 +545,8 @@ SimpleNetworkDriverStart ( // the IO BAR. Save the index of the BAR into the adapter info structure. // for regular 32bit BARs, 0 is memory mapped, 1 is io mapped // - ConfigHeader = (PCI_TYPE00 *) &ConfigInfo.Config.Byte[0]; - TempBar = (UINT32 *) &ConfigHeader->Device.Bar[0]; + ConfigHeader = (PCI_TYPE00 *) ConfigInfo.Config.Byte; + TempBar = (UINT32 *) ConfigHeader->Device.Bar; for (BarIndex = 0; BarIndex <= 5; BarIndex++) { if ((*TempBar & PCI_BAR_MEM_MASK) == PCI_BAR_MEM_64BIT) { // diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index e016cc0f51..1293f67268 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -477,6 +477,7 @@ PxeBcCheckSelectedOffer ( // Status = EFI_NO_RESPONSE; + ASSERT (Private->NumOffers < PXEBC_MAX_OFFER_NUM); for (Index = 0; Index < Private->NumOffers; Index++) { Offer = &Private->Dhcp4Offers[Index].Packet.Offer; diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c index 3c55a785fc..0f0da166ad 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c @@ -123,10 +123,11 @@ DevicePathToStr ( TRUE ); if (Text == NULL) { - return AllocateCopyPool (sizeof (L"?"), L"?"); - } else { - return Text; + Text = AllocateCopyPool (sizeof (L"?"), L"?"); + ASSERT (Text != NULL); } + + return Text; } /** diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index e806b504b2..22f257dd4e 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -1,7 +1,7 @@ /** @file Parser for IFR binary encoding. -Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -663,6 +663,7 @@ InitializeRequestElement ( ASSERT (ConfigInfo != NULL); ConfigInfo->Signature = FORM_BROWSER_CONFIG_REQUEST_SIGNATURE; ConfigInfo->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr); + ASSERT (ConfigInfo->ConfigRequest != NULL); ConfigInfo->SpareStrLen = 0; ConfigInfo->Storage = Storage; InsertTailList(&Form->ConfigRequestHead, &ConfigInfo->Link); @@ -2327,6 +2328,7 @@ ParseOpCodes ( break; case EFI_IFR_ONE_OF_OPTION_OP: + ASSERT (CurrentOption != NULL); ImageId = &CurrentOption->ImageId; break; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index bad8b7b122..f06b8a20d4 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -397,8 +397,11 @@ UpdateHotkeyList ( HotKey = BROWSER_HOT_KEY_FROM_LINK (Link); CopyKey = AllocateCopyPool(sizeof (BROWSER_HOT_KEY), HotKey); + ASSERT (CopyKey != NULL); CopyKey->KeyData = AllocateCopyPool(sizeof (EFI_INPUT_KEY), HotKey->KeyData); + ASSERT (CopyKey->KeyData != NULL); CopyKey->HelpString = AllocateCopyPool(StrSize (HotKey->HelpString), HotKey->HelpString); + ASSERT (CopyKey->HelpString != NULL); InsertTailList(&gDisplayFormData.HotKeyListHead, &CopyKey->Link); @@ -1977,6 +1980,7 @@ ProcessCallBackFunction ( if (Action == EFI_BROWSER_ACTION_CHANGING) { if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) { BackUpBuffer = AllocateCopyPool(Statement->StorageWidth + sizeof(CHAR16), Statement->BufferValue); + ASSERT (BackUpBuffer != NULL); } else { CopyMem (&BackUpValue, &HiiValue->Value, sizeof (EFI_IFR_TYPE_VALUE)); } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 3f2f1b5468..4ba0cb0903 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -4060,8 +4060,11 @@ GetDefaultForFormset ( } TmpNode = AllocateCopyPool (sizeof (NAME_VALUE_NODE), Node); + ASSERT (TmpNode != NULL); TmpNode->Name = AllocateCopyPool (StrSize(Node->Name) * sizeof (CHAR16), Node->Name); + ASSERT (TmpNode->Name != NULL); TmpNode->EditValue = AllocateCopyPool (StrSize(Node->EditValue) * sizeof (CHAR16), Node->EditValue); + ASSERT (TmpNode->EditValue != NULL); InsertTailList(&BackUpList, &TmpNode->Link); } -- 2.39.2