mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Fixed Memory Corruption when updating the path of a Linux initrd
Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13264 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1c8f9a70d0
commit
14238a61c8
|
@ -354,7 +354,8 @@ BootMenuUpdateBootOption (
|
||||||
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
|
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
|
||||||
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||||
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
|
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
|
||||||
EFI_DEVICE_PATH* DevicePath;
|
EFI_DEVICE_PATH *DevicePath;
|
||||||
|
EFI_DEVICE_PATH *TempInitrdPath;
|
||||||
ARM_BDS_LOADER_TYPE BootType;
|
ARM_BDS_LOADER_TYPE BootType;
|
||||||
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
|
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
|
||||||
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
|
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
|
||||||
|
@ -423,11 +424,13 @@ BootMenuUpdateBootOption (
|
||||||
|
|
||||||
if (InitrdPathNode != NULL) {
|
if (InitrdPathNode != NULL) {
|
||||||
// Duplicate Linux kernel Device Path
|
// Duplicate Linux kernel Device Path
|
||||||
DevicePath = DuplicateDevicePath (BootOption->FilePathList);
|
TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
|
||||||
// Replace Linux kernel Node by EndNode
|
// Replace Linux kernel Node by EndNode
|
||||||
SetDevicePathEndNode (GetLastDevicePathNode (DevicePath));
|
SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
|
||||||
// Append the Device Path node to the select device path
|
// Append the Device Path node to the select device path
|
||||||
InitrdPath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
|
InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
|
||||||
|
FreePool (TempInitrdPath);
|
||||||
|
InitrdSize = GetDevicePathSize (InitrdPath);
|
||||||
} else {
|
} else {
|
||||||
InitrdPath = NULL;
|
InitrdPath = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue