[edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last block value
Gao, Zhichao
zhichao.gao at intel.com
Wed Jul 8 02:27:20 UTC 2020
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
The MBR last block value should be sector (512 bytes) numbers.
Cc: Hao A Wu <hao.a.wu at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Laszlo Ersek <lersek at redhat.com>
Signed-off-by: Zhichao Gao <zhichao.gao at intel.com>
---
MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index dac451a144..aa0b6cadcc 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -137,12 +137,14 @@ PartitionInstallMbrChildHandles (
UINT32 MediaId;
EFI_LBA LastBlock;
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
+ UINT64 MediaSize;
Found = EFI_NOT_FOUND;
BlockSize = BlockIo->Media->BlockSize;
MediaId = BlockIo->Media->MediaId;
- LastBlock = BlockIo->Media->LastBlock;
+ MediaSize = MultU64x32 (BlockIo->Media->LastBlock + 1, BlockSize);
+ LastBlock = DivU64x32 (MediaSize, 512) - 1;
//
// Ensure the block size can hold the MBR
--
2.21.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#62186): https://edk2.groups.io/g/devel/message/62186
Mute This Topic: https://groups.io/mt/75369397/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list