From: Laszlo Ersek Date: Sat, 9 Sep 2017 22:42:02 +0000 (+0200) Subject: MdeModulePkg/PartitionDxe: remove always false comparison X-Git-Tag: edk2-stable201903~3427 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b4e5807d2492efd9fc453b0a09a50f4c3ae77be1;hp=b19aeeb91e3c548a7f42828f4d474e23ae6b59b8 MdeModulePkg/PartitionDxe: remove always false comparison In the expression (RemainderByMediaBlockSize != 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 == 0 then UDF_LOGICAL_SECTOR_SIZE is a whole multiple of "Media->BlockSize", which implies UDF_LOGICAL_SECTOR_SIZE >= 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 Reviewed-by: Star Zeng Reviewed-by: Paulo Alcantara Reviewed-by: Ard Biesheuvel --- diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c index e46cf1d4f4..7856b5dfc1 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c @@ -261,8 +261,7 @@ PartitionInstallUdfChildHandles ( Media->BlockSize, // Divisor &RemainderByMediaBlockSize // Remainder ); - if (RemainderByMediaBlockSize != 0 || - Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) { + if (RemainderByMediaBlockSize != 0) { return EFI_NOT_FOUND; }