Fix new Klocwork scanning issues
This patch fixed some new reported klocwork scanning issues. Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
parent
aeef6df940
commit
99332b68dc
|
@ -885,7 +885,7 @@ LoadComponentWithCallback (
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CompressHdr->Size == 0) {
|
if (CompressHdr->Size == 0) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_BAD_BUFFER_SIZE;
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -748,12 +748,22 @@ Ext2fsOpen (
|
||||||
// allocate struct file system specific data structure
|
// allocate struct file system specific data structure
|
||||||
//
|
//
|
||||||
Fp = AllocatePool (sizeof (FILE));
|
Fp = AllocatePool (sizeof (FILE));
|
||||||
|
if (Fp == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
SetMem32 (Fp, sizeof (FILE), 0 );
|
SetMem32 (Fp, sizeof (FILE), 0 );
|
||||||
File->FileSystemSpecificData = (VOID *)Fp;
|
File->FileSystemSpecificData = (VOID *)Fp;
|
||||||
//
|
//
|
||||||
// allocate space and read super block
|
// allocate space and read super block
|
||||||
//
|
//
|
||||||
FileSystem = AllocatePool (sizeof (*FileSystem));
|
FileSystem = AllocatePool (sizeof (*FileSystem));
|
||||||
|
if (FileSystem == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
SetMem32 (FileSystem, sizeof (*FileSystem), 0);
|
SetMem32 (FileSystem, sizeof (*FileSystem), 0);
|
||||||
Fp->SuperBlockPtr = FileSystem;
|
Fp->SuperBlockPtr = FileSystem;
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,17 @@ MmcGetHcPrivateData (
|
||||||
Status = GetLibraryData (PcdGet8 (PcdEmmcBlockDeviceLibId), (VOID **)&PrivateData);
|
Status = GetLibraryData (PcdGet8 (PcdEmmcBlockDeviceLibId), (VOID **)&PrivateData);
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
PrivateData = AllocatePool (sizeof (SD_MMC_HC_PRIVATE_DATA));
|
PrivateData = AllocatePool (sizeof (SD_MMC_HC_PRIVATE_DATA));
|
||||||
ZeroMem (PrivateData, sizeof (SD_MMC_HC_PRIVATE_DATA));
|
if (PrivateData != NULL) {
|
||||||
if (GetLoaderStage () == LOADER_STAGE_PAYLOAD) {
|
ZeroMem (PrivateData, sizeof (SD_MMC_HC_PRIVATE_DATA));
|
||||||
PrivateData->PrivateDataMemType = PayloadMemory;
|
if (GetLoaderStage () == LOADER_STAGE_PAYLOAD) {
|
||||||
|
PrivateData->PrivateDataMemType = PayloadMemory;
|
||||||
|
} else {
|
||||||
|
PrivateData->PrivateDataMemType = ReservedMemory;
|
||||||
|
}
|
||||||
|
Status = SetLibraryData (PcdGet8 (PcdEmmcBlockDeviceLibId), PrivateData, sizeof (SD_MMC_HC_PRIVATE_DATA));
|
||||||
} else {
|
} else {
|
||||||
PrivateData->PrivateDataMemType = ReservedMemory;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
Status = SetLibraryData (PcdGet8 (PcdEmmcBlockDeviceLibId), PrivateData, sizeof (SD_MMC_HC_PRIVATE_DATA));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
Loading…
Reference in New Issue