From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.13514.1594619927489357404 for ; Sun, 12 Jul 2020 22:58:47 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: ray.ni@intel.com) IronPort-SDR: fDMbWvqIFXAmxv5hBfFWABizCuoQT1a2ZVGC1KddhGo2ZM8V6Iag6kO4bgiVJz3DZR/GaZhjH/ tNoxiX8pK0hw== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="128616383" X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="128616383" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 22:58:46 -0700 IronPort-SDR: 6U5y5pvJpSCV4yVmJnOvry7MvKA0EOPd1kmZDZVV0q3CGPb98Ec3tjYWgXff/VX8HZVPbUZGMI /ZJMYbPsSKYQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="429252900" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 12 Jul 2020 22:58:45 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 22:58:45 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jul 2020 22:58:45 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.135]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.22]) with mapi id 14.03.0439.000; Mon, 13 Jul 2020 13:58:42 +0800 From: "Ni, Ray" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Wu, Hao A" , Laszlo Ersek Subject: Re: [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last block value Thread-Topic: [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last block value Thread-Index: AQHWVM9WbaTZGZ553kmPGz46rEGz3KkFCpaA Date: Mon, 13 Jul 2020 05:58:42 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C611468@SHSMSX104.ccr.corp.intel.com> References: <20200708022722.27024-1-zhichao.gao@intel.com> <20200708022722.27024-2-zhichao.gao@intel.com> In-Reply-To: <20200708022722.27024-2-zhichao.gao@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 1. Can you rename LastBlock to LastSector and remove the MediaSize local va= riable? 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 > Sent: Wednesday, July 8, 2020 10:27 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Ni, Ray ; Laszlo Er= sek > > Subject: [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Correct the MBR last > block value >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2823 >=20 > The MBR last block value should be sector (512 bytes) numbers. >=20 > Cc: Hao A Wu > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Zhichao Gao > --- > MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > 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; >=20 > Found =3D EFI_NOT_FOUND; >=20 > BlockSize =3D BlockIo->Media->BlockSize; > MediaId =3D BlockIo->Media->MediaId; > - LastBlock =3D BlockIo->Media->LastBlock; > + MediaSize =3D MultU64x32 (BlockIo->Media->LastBlock + 1, BlockSize); > + LastBlock =3D DivU64x32 (MediaSize, 512) - 1; >=20 > // > // Ensure the block size can hold the MBR > -- > 2.21.0.windows.1