From 261136bc32b456800f6dec7eedadea5b2a153eca Mon Sep 17 00:00:00 2001 From: hfang Date: Mon, 23 Mar 2009 09:12:51 +0000 Subject: fix Klocwork issues git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7926 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/DxeReportStatusCodeLibFramework/DxeSupport.c | 4 +++- .../PciIncompatibleDeviceSupportLib.c | 9 +++++++++ .../Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c | 4 +++- .../SmmRuntimeDxeSupport.c | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) (limited to 'IntelFrameworkModulePkg/Library') diff --git a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeSupport.c b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeSupport.c index 602e42b182..bfa5e51305 100644 --- a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeSupport.c +++ b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeSupport.c @@ -125,7 +125,9 @@ InternalReportStatusCodeEx ( // // Fill in the extended data buffer // - CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize); + if (ExtendedData != NULL) { + CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize); + } // // Report the status code diff --git a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c index 08c95b6526..61a936de12 100644 --- a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c +++ b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c @@ -137,6 +137,9 @@ PciResourceUpdateCheck ( AcpiPtr = AllocateZeroPool ( sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR) ); + if (AcpiPtr == NULL) { + return EFI_OUT_OF_RESOURCES; + } OldAcpiPtr = AcpiPtr; @@ -255,6 +258,9 @@ PciRegisterUpdateCheck ( Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2); RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA)); + if (RegisterPtr == NULL) { + return EFI_SUCCESS; + } RegisterPtr->AndValue = Dsc->AndValue; RegisterPtr->OrValue = Dsc->OrValue; @@ -356,6 +362,9 @@ PciRegisterAccessCheck ( if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) { RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA)); + if (RegisterPtr == NULL) { + return EFI_OUT_OF_RESOURCES; + } RegisterPtr->StartOffset = Dsc->StartOffset; RegisterPtr->EndOffset = Dsc->EndOffset; diff --git a/IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c index d027dc4a8e..4f0901b1d2 100644 --- a/IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c +++ b/IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c @@ -471,7 +471,9 @@ ReportStatusCodeEx ( ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid; } CopyGuid (&StatusCodeData->Type, ExtendedDataGuid); - CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize); + if (ExtendedData != NULL) { + CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize); + } if (CallerId == NULL) { CallerId = &gEfiCallerIdGuid; } diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c index c680160831..e176ecc36b 100644 --- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c +++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c @@ -292,7 +292,9 @@ InternalReportStatusCodeEx ( // // Fill in the extended data buffer // - CopyMem (mStatusCodeData + 1, ExtendedData, ExtendedDataSize); + if (ExtendedData != NULL) { + CopyMem (mStatusCodeData + 1, ExtendedData, ExtendedDataSize); + } // // Report the status code -- cgit v1.2.3