From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.9765.1597128205251494090 for ; Mon, 10 Aug 2020 23:43:25 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: zhichao.gao@intel.com) IronPort-SDR: h6ZmXkvF/Xd/OFYw2VXfFaJ7Q2whEhJkEBhAQIrvQ7VD5nu1j4PlyT/E1P8ZVhztMcFnM8qJKP Lvtjvnr5eBtQ== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="215195338" X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="215195338" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2020 23:43:17 -0700 IronPort-SDR: 8TjbgzTKny8HTOURZcOVTjcQiNNWhWznDBCVzGcDh2YkTbqHUoTKcRPW7RQU+xFn9Rj/G9BXYN 6UdvGyiY4fcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="334477064" Received: from fieedk001.ccr.corp.intel.com ([10.239.153.108]) by orsmga007.jf.intel.com with ESMTP; 10 Aug 2020 23:43:15 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni , Gary Lin , Andrew Fish Subject: [PATCH 3/3] MdeModulePkg/PartitionDxe: Fix the incorrect LBA size in child hander Date: Tue, 11 Aug 2020 14:43:02 +0800 Message-Id: <20200811064302.33188-4-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200811064302.33188-1-zhichao.gao@intel.com> References: <20200811064302.33188-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 --- 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