Hi Samer, Could you help to also update the code in RamDiskImpl.c line 573 for the same issue? Reviewed-by: Hao Wu <[email protected]>
Best Regards, Hao Wu > -----Original Message----- > From: Samer El-Haj-Mahmoud [mailto:[email protected]] > Sent: Wednesday, March 30, 2016 7:13 AM > To: [email protected] > Cc: [email protected]; Wu, Hao A; Tian, Feng; Samer El-Haj-Mahmoud; > Samer El-Haj-Mahmoud > Subject: [PATCH] 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. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Samer El-Haj-Mahmoud <[email protected]> > Signed-off-by: Tapan Shah <[email protected]> > --- > MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c > b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c > index 0c1df9d..de11721 100644 > --- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c > +++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c > @@ -2,6 +2,7 @@ > The realization of EFI_RAM_DISK_PROTOCOL. > > Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> > + (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > This program and the accompanying materials > 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 > @@ -50,7 +51,7 @@ RamDiskInitDeviceNode ( > ); > WriteUnaligned64 ( > (UINT64 *) &(RamDiskDevNode->EndingAddr[0]), > - (UINT64) PrivateData->StartingAddr + PrivateData->Size > + (UINT64) PrivateData->StartingAddr + PrivateData->Size - 1 > ); > CopyGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid); > RamDiskDevNode->Instance = PrivateData->InstanceNumber; > @@ -305,7 +306,7 @@ RamDiskUnregister ( > // and type guid. > // > if ((StartingAddr == PrivateData->StartingAddr) && > - (EndingAddr == PrivateData->StartingAddr + PrivateData->Size) && > + (EndingAddr == PrivateData->StartingAddr + PrivateData->Size - 1) > && > (CompareGuid (&RamDiskDevNode->TypeGuid, &PrivateData- > >TypeGuid))) { > // > // Uninstall the EFI_DEVICE_PATH_PROTOCOL & > EFI_BLOCK_IO(2)_PROTOCOL > -- > 2.6.3.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

