From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A49B3208F7AD7 for ; Tue, 12 Sep 2017 01:47:41 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 01:50:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,382,1500966000"; d="scan'208";a="310672726" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 12 Sep 2017 01:50:37 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 01:50:37 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.168]) with mapi id 14.03.0319.002; Tue, 12 Sep 2017 16:50:35 +0800 From: "Zeng, Star" To: Laszlo Ersek , edk2-devel-01 CC: Ard Biesheuvel , "Dong, Eric" , Paulo Alcantara , "Ni, Ruiyu" , "Zeng, Star" Thread-Topic: [PATCH 5/5] MdeModulePkg/PartitionDxe: remove always false comparison Thread-Index: AQHTKcmj9amG5QzipEePphvSlI9SCKKw9KVw Date: Tue, 12 Sep 2017 08:50:35 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9400D6@shsmsx102.ccr.corp.intel.com> References: <20170910001304.8628-1-lersek@redhat.com> <20170910001304.8628-6-lersek@redhat.com> In-Reply-To: <20170910001304.8628-6-lersek@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 5/5] MdeModulePkg/PartitionDxe: remove always false comparison X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Sep 2017 08:47:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com]=20 Sent: Sunday, September 10, 2017 8:13 AM To: edk2-devel-01 Cc: Ard Biesheuvel ; Dong, Eric ; Paulo Alcantara ; Ni, Ruiyu ; = Zeng, Star Subject: [PATCH 5/5] MdeModulePkg/PartitionDxe: remove always false compari= son In the expression (RemainderByMediaBlockSize !=3D 0 || Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) the second expression is only evaluated if the first expression is false. If the first expression is false, i.e., RemainderByMediaBlockSize =3D=3D 0 then UDF_LOGICAL_SECTOR_SIZE is a whole multiple of "Media->BlockSize", whi= ch implies UDF_LOGICAL_SECTOR_SIZE >=3D Media->BlockSize. Therefore whenever Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE is evaluated, it is false. The expression ((expression) || FALSE) is equivalent to (expression). Cc: Ard Biesheuvel Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/= Universal/Disk/PartitionDxe/Udf.c index c491ef25f47e..3347b48421a8 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c @@ -252,12 +252,11 @@ PartitionInstallUdfChildHandles ( DivU64x32Remainder ( UDF_LOGICAL_SECTOR_SIZE, // Dividend Media->BlockSize, // Divisor &RemainderByMediaBlockSize // Remainder ); - if (RemainderByMediaBlockSize !=3D 0 || - Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) { + if (RemainderByMediaBlockSize !=3D 0) { return EFI_NOT_FOUND; } =20 DevicePathNode =3D DevicePath; while (!IsDevicePathEnd (DevicePathNode)) { -- 2.14.1.3.gb7cf6e02401b