Resolve Klocwork issues in Payload & Platform
Klocwork scanning reported several issues in the PayloadPkg and Platform code folders, this commit aims to resolve all of the issues currently being reported in these folders. Signed-off-by: James Gutbub <james.gutbub@intel.com>
This commit is contained in:
parent
cc46751e0c
commit
327fbac532
|
@ -243,6 +243,7 @@ LoadCapsuleImage (
|
|||
CHAR16 FileName[MAX_FILE_LEN];
|
||||
EFI_HANDLE FileHandle;
|
||||
|
||||
FileHandle = NULL;
|
||||
HwPartHandle = NULL;
|
||||
Status = FindBootPartition (CapsuleInfo, &HwPartHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -273,9 +274,8 @@ LoadCapsuleImage (
|
|||
}
|
||||
|
||||
//
|
||||
// get capsule image size.
|
||||
// Get capsule image size.
|
||||
//
|
||||
FileHandle = NULL;
|
||||
*CapsuleImageSize = 0;
|
||||
*CapsuleImage = NULL;
|
||||
|
||||
|
|
|
@ -232,7 +232,9 @@ SecStartup (
|
|||
|
||||
// ACPI table
|
||||
SystemTableInfo = GetSystemTableInfo ();
|
||||
if (SystemTableInfo != NULL) {
|
||||
ParseAcpiTableInfo ((UINT32)SystemTableInfo->AcpiTableBase);
|
||||
}
|
||||
|
||||
DEBUG_CODE_BEGIN ();
|
||||
// Initialize HOB/Stack region with known pattern so that the usage can be detected
|
||||
|
|
|
@ -112,6 +112,7 @@ SeedSanityCheck (
|
|||
ClearSeedHOB = FALSE;
|
||||
UseedCount = 0;
|
||||
DseedCount = 0;
|
||||
SeedListLen = 0;
|
||||
|
||||
OsBootOptionList = GetBootOptionList ();
|
||||
if ((OsBootOptionList == NULL) || (OsBootOptionList->OsBootOptionCount == 0)) {
|
||||
|
@ -119,7 +120,7 @@ SeedSanityCheck (
|
|||
}
|
||||
|
||||
SeedListInfo = GetSeedListInfoHOB (&SeedListLen);
|
||||
if ((SeedListInfo == NULL) || (SeedListLen < 0)) {
|
||||
if ((SeedListInfo == NULL) || (SeedListLen == 0)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ LoadLinuxFile (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (FileInfo->Buf[0] == 0) {
|
||||
if ((FileInfo->Buf[0] == 0) && (ConfigFile != NULL)) {
|
||||
Ptr = ConfigFile + FileInfo->Pos;
|
||||
} else {
|
||||
Ptr = FileInfo->Buf + FileInfo->Pos;
|
||||
|
@ -390,10 +390,13 @@ GetTraditionalLinux (
|
|||
EFI_HANDLE FileHandle;
|
||||
BOOLEAN DefBootOption;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Try booting Linux from config file ...\n"));
|
||||
|
||||
ConfigFile = NULL;
|
||||
ConfigFileSize = 0;
|
||||
DefBootOption = FALSE;
|
||||
Status = RETURN_NOT_FOUND;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Try booting Linux from config file ...\n"));
|
||||
|
||||
for (Index = 0; Index < (UINTN)(FeaturePcdGet (PcdGrubBootCfgEnabled) ? 2 : 1); Index++) {
|
||||
DEBUG ((DEBUG_INFO, "Checking %s\n",mConfigFileName[Index]));
|
||||
ConfigFile = NULL;
|
||||
|
@ -477,7 +480,7 @@ GetTraditionalLinux (
|
|||
|
||||
// Update command line
|
||||
LinuxImage->CmdFile.Size = LinuxBootCfg.MenuEntry[EntryIdx].Command.Len;
|
||||
if (LinuxImage->CmdFile.Size > 0) {
|
||||
if ((LinuxImage->CmdFile.Size > 0) && (ConfigFile != NULL)) {
|
||||
Ptr = (CHAR8 *)ConfigFile + LinuxBootCfg.MenuEntry[EntryIdx].Command.Pos;
|
||||
Ptr[LinuxImage->CmdFile.Size] = 0;
|
||||
LinuxImage->CmdFile.Addr = Ptr;
|
||||
|
|
|
@ -150,6 +150,7 @@ SpiLoadExternalConfigData (
|
|||
Address = 0;
|
||||
BlobSize = sizeof(CDATA_BLOB);
|
||||
Buffer = (UINT8 *)Dst;
|
||||
Base = 0;
|
||||
|
||||
CfgDataLoadSrc = PcdGet32 (PcdCfgDataLoadSource);
|
||||
|
||||
|
@ -197,10 +198,10 @@ SpiLoadExternalConfigData (
|
|||
if (CfgDataLoadSrc == FlashRegionPlatformData) {
|
||||
Status = SpiFlashRead (FlashRegionPlatformData, Address + BlobSize, SignedLen - BlobSize, Buffer + BlobSize);
|
||||
} else {
|
||||
if (Base > 0) {
|
||||
CopyMem (Buffer + BlobSize, (VOID *)(Base + BlobSize), SignedLen - BlobSize);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue