[CFL] Fix Klockwork scanning issues

This patch adds necessary check to avoid NULL pointer dereference

Signed-off-by: Praveen HP <praveen.hodagatta.pranesh@intel.com>
This commit is contained in:
Praveen HP 2020-08-26 01:26:35 +08:00 committed by Maurice Ma
parent 99332b68dc
commit f7c26922d3
2 changed files with 6 additions and 0 deletions

View File

@ -638,6 +638,9 @@ DEBUG_CODE_END();
EarlyBootDeviceInit ();
}
PltDeviceTable = (PLT_DEVICE_TABLE *)AllocatePool (sizeof (PLT_DEVICE_TABLE) + sizeof (mPlatformDevices));
if (PltDeviceTable == NULL) {
return;
}
PltDeviceTable->DeviceNumber = sizeof (mPlatformDevices) /sizeof (PLT_DEVICE);
CopyMem (PltDeviceTable->Device, mPlatformDevices, sizeof (mPlatformDevices));
SetDeviceTable (PltDeviceTable);

View File

@ -1260,6 +1260,9 @@ UpdateFspConfig (
FspsUpd->FspsConfig.TcoIrqSelect = 9;
HdaVerbTablePtr = (UINT32 *) AllocateZeroPool (6 * sizeof (UINT32)); // max 6 tables supported for now
if (HdaVerbTablePtr == NULL) {
return;
}
HdaVerbTableNum = 0;
HdaVerbTablePtr[HdaVerbTableNum++] = (UINT32)(UINTN) &HdaVerbTableDisplayAudio;
if (IsPchLp()) {