mirror of https://github.com/acidanthera/audk.git
MdeModulePkg RamDiskDxe: Fix incorrect RAM disk memory address calculation
EndingAddress is calculated incorrectly. Original code calculates it as (StartingAddress + Size). Correct value should be (StartingAddress + Size - 1. Note: Besides the changes made by Samer, Hao also fixed a similar issue in RamDiskImpl.c Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Signed-off-by: Tapan Shah <tapandshah@hpe.com> Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
This commit is contained in:
parent
307a55fa01
commit
5eae4ff002
|
@ -566,7 +566,7 @@ UpdateMainForm (
|
||||||
L" RAM Disk %d: [0x%lx, 0x%lx]\n",
|
L" RAM Disk %d: [0x%lx, 0x%lx]\n",
|
||||||
Index,
|
Index,
|
||||||
PrivateData->StartingAddr,
|
PrivateData->StartingAddr,
|
||||||
PrivateData->StartingAddr + PrivateData->Size
|
PrivateData->StartingAddr + PrivateData->Size - 1
|
||||||
);
|
);
|
||||||
|
|
||||||
StringId = HiiSetString (ConfigPrivate->HiiHandle, 0, RamDiskStr, NULL);
|
StringId = HiiSetString (ConfigPrivate->HiiHandle, 0, RamDiskStr, NULL);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
The realization of EFI_RAM_DISK_PROTOCOL.
|
The realization of EFI_RAM_DISK_PROTOCOL.
|
||||||
|
|
||||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -50,7 +51,7 @@ RamDiskInitDeviceNode (
|
||||||
);
|
);
|
||||||
WriteUnaligned64 (
|
WriteUnaligned64 (
|
||||||
(UINT64 *) &(RamDiskDevNode->EndingAddr[0]),
|
(UINT64 *) &(RamDiskDevNode->EndingAddr[0]),
|
||||||
(UINT64) PrivateData->StartingAddr + PrivateData->Size
|
(UINT64) PrivateData->StartingAddr + PrivateData->Size - 1
|
||||||
);
|
);
|
||||||
CopyGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid);
|
CopyGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid);
|
||||||
RamDiskDevNode->Instance = PrivateData->InstanceNumber;
|
RamDiskDevNode->Instance = PrivateData->InstanceNumber;
|
||||||
|
@ -305,7 +306,7 @@ RamDiskUnregister (
|
||||||
// and type guid.
|
// and type guid.
|
||||||
//
|
//
|
||||||
if ((StartingAddr == PrivateData->StartingAddr) &&
|
if ((StartingAddr == PrivateData->StartingAddr) &&
|
||||||
(EndingAddr == PrivateData->StartingAddr + PrivateData->Size) &&
|
(EndingAddr == PrivateData->StartingAddr + PrivateData->Size - 1) &&
|
||||||
(CompareGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid))) {
|
(CompareGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid))) {
|
||||||
//
|
//
|
||||||
// Uninstall the EFI_DEVICE_PATH_PROTOCOL & EFI_BLOCK_IO(2)_PROTOCOL
|
// Uninstall the EFI_DEVICE_PATH_PROTOCOL & EFI_BLOCK_IO(2)_PROTOCOL
|
||||||
|
|
Loading…
Reference in New Issue