From e0eacd7daa6f2e59de2b35a5dfe8bb4c38821e31 Mon Sep 17 00:00:00 2001 From: Zhichao Gao Date: Tue, 11 Aug 2020 14:26:25 +0800 Subject: MdeModulePkg/PartitionDxe: Fix the incorrect LBA size in child hander REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2843 PartitionInstallChildHandle's parameters Start and End is counted by the BlockSize, but in the implementation it uses the parent device's BlockSize to calculate the new Start, End and LastBlock. It would cause the driver report incorrect block scope and the file system would fail to be found with right block scope. So correct it to the right value. Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Gary Lin Cc: Andrew Fish Signed-off-by: Zhichao Gao Reviewed-by: Ray Ni Reviewed-by: Hao A Wu Tested-by: Gary Lin --- MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'MdeModulePkg/Universal') diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c index 473e091320..f10ce7c65b 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c @@ -1149,8 +1149,8 @@ PartitionInstallChildHandle ( Private->Signature = PARTITION_PRIVATE_DATA_SIGNATURE; - Private->Start = MultU64x32 (Start, ParentBlockIo->Media->BlockSize); - Private->End = MultU64x32 (End + 1, ParentBlockIo->Media->BlockSize); + Private->Start = MultU64x32 (Start, BlockSize); + Private->End = MultU64x32 (End + 1, BlockSize); Private->BlockSize = BlockSize; Private->ParentBlockIo = ParentBlockIo; @@ -1187,13 +1187,7 @@ PartitionInstallChildHandle ( Private->Media.IoAlign = 0; Private->Media.LogicalPartition = TRUE; - Private->Media.LastBlock = DivU64x32 ( - MultU64x32 ( - End - Start + 1, - ParentBlockIo->Media->BlockSize - ), - BlockSize - ) - 1; + Private->Media.LastBlock = End - Start; Private->Media.BlockSize = (UINT32) BlockSize; -- cgit v1.2.3