mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Test if OptionalData is NULL before using it
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16515 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
830e5b8c0f
commit
b4c222655c
|
@ -221,6 +221,8 @@ BootOptionSetFields (
|
||||||
WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);
|
WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);
|
||||||
WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
|
WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
|
||||||
|
|
||||||
|
// OptionalData should have been initialized by the caller of this function
|
||||||
|
ASSERT (OptionalData != NULL);
|
||||||
BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;
|
BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;
|
||||||
SrcLinuxArguments = &(BootArguments->LinuxArguments);
|
SrcLinuxArguments = &(BootArguments->LinuxArguments);
|
||||||
DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
|
DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
|
||||||
|
@ -237,8 +239,10 @@ BootOptionSetFields (
|
||||||
CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
|
CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (OptionalData != NULL) {
|
||||||
CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
|
CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BootOption->OptionalDataSize = OptionalDataSize;
|
BootOption->OptionalDataSize = OptionalDataSize;
|
||||||
|
|
||||||
// If this function is called at the creation of the Boot Device entry (not at the update) the
|
// If this function is called at the creation of the Boot Device entry (not at the update) the
|
||||||
|
|
Loading…
Reference in New Issue