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....@intel.com>
> Sent: Wednesday, July 8, 2020 10:27 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a...@intel.com>; Ni, Ray <ray...@intel.com>; Laszlo Ersek
> <ler...@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...@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Signed-off-by: Zhichao Gao <zhichao....@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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to