fix: [Common] Dereference null return TempSmbiosStrTbl (#1951)
If the function actually returns a null value, a null pointer dereference will occur. In InitializeSmbiosInfo: Return value of function which returns null is dereferenced without checking (CWE-476) Signed-off-by: Randy <randy.lin@intel.com>
This commit is contained in:
parent
a8637fecd2
commit
6a818eb039
|
@ -154,7 +154,10 @@ InitializeSmbiosInfo (
|
|||
PlatformId = GetPlatformId ();
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "TempSmbiosStrTbl allocation failed\n"));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
//
|
||||
// SMBIOS_TYPE_BIOS_INFORMATION
|
||||
//
|
||||
|
|
|
@ -567,6 +567,9 @@ InitializeSmbiosInfo (
|
|||
Index = 0;
|
||||
PlatformId = GetPlatformId ();
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
|
@ -743,6 +743,9 @@ InitializeSmbiosInfo (
|
|||
Index = 0;
|
||||
PlatformId = GetPlatformId ();
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
|
@ -736,6 +736,9 @@ InitializeSmbiosInfo (
|
|||
Index = 0;
|
||||
PlatformId = GetPlatformId ();
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
|
@ -484,8 +484,10 @@ InitializeSmbiosInfo (
|
|||
|
||||
Index = 0;
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
// SMBIOS_TYPE_BIOS_INFORMATION
|
||||
//
|
||||
|
|
|
@ -67,6 +67,9 @@ InitializeSmbiosInfo (
|
|||
if (FeaturePcdGet (PcdSmbiosEnabled)) {
|
||||
Index = 0;
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
|
@ -313,6 +313,9 @@ InitializeSmbiosInfo (
|
|||
|
||||
Index = 0;
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
|
@ -540,6 +540,9 @@ InitializeSmbiosInfo (
|
|||
|
||||
Index = 0;
|
||||
TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
|
||||
if (TempSmbiosStrTbl == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
VerInfoTbl = GetVerInfoPtr ();
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue