From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.6027.1597195289387869314 for ; Tue, 11 Aug 2020 18:21:33 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: zhichao.gao@intel.com) IronPort-SDR: 6uC5twzN9mQKaZkAgv4N2jkvi2cBIcgZGhNAeO3f/S/LDFEkXp933M/wzbrUyMlDJhh/2fQgZ9 q0yEtiwA039g== X-IronPort-AV: E=McAfee;i="6000,8403,9710"; a="171908241" X-IronPort-AV: E=Sophos;i="5.76,302,1592895600"; d="scan'208";a="171908241" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 18:21:33 -0700 IronPort-SDR: MBJoWGP27o6a4j2RRHm7S7HP8LSOhgBLRPG6LLiQDSShnRx2mMuiUblvxgsQEI+l0C9BUaUvZc ljee5Yg3epbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,302,1592895600"; d="scan'208";a="494868752" Received: from fieedk001.ccr.corp.intel.com ([10.239.153.108]) by fmsmga006.fm.intel.com with ESMTP; 11 Aug 2020 18:21:31 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni , Gary Lin , Andrew Fish Subject: [PATCH V2 3/3] MdeModulePkg/PartitionDxe: Fix the incorrect LBA size in child hander Date: Wed, 12 Aug 2020 09:21:24 +0800 Message-Id: <20200812012124.18220-4-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200812012124.18220-1-zhichao.gao@intel.com> References: <20200812012124.18220-1-zhichao.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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; -- 2.21.0.windows.1