[edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last block value

Ni, Ray ray.ni at intel.com
Mon Jul 13 05:58:42 UTC 2020


1. Can you rename LastBlock to LastSector and remove the MediaSize local variable?
2. Can you add comments to describe that sector size is 512?
3. Can you explain why this fix is needed in the commit message?

Thanks,
Ray



> -----Original Message-----
> From: Gao, Zhichao <zhichao.gao at intel.com>
> Sent: Wednesday, July 8, 2020 10:27 AM
> To: devel at edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu at intel.com>; Ni, Ray <ray.ni at intel.com>; Laszlo Ersek
> <lersek at redhat.com>
> Subject: [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last
> block value
> 
> 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 (#62391): https://edk2.groups.io/g/devel/message/62391
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