]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PartitionDxe: remove always false comparison
authorLaszlo Ersek <lersek@redhat.com>
Sat, 9 Sep 2017 22:42:02 +0000 (00:42 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 12 Sep 2017 10:12:31 +0000 (12:12 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c

index e46cf1d4f49c080c991b88f3f800934ad1a58f8f..7856b5dfc1b1caf79ab0d6747e3dfd6670f32e2a 100644 (file)
@@ -261,8 +261,7 @@ PartitionInstallUdfChildHandles (
     Media->BlockSize,          // Divisor\r
     &RemainderByMediaBlockSize // Remainder\r
     );\r
-  if (RemainderByMediaBlockSize != 0 ||\r
-      Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) {\r
+  if (RemainderByMediaBlockSize != 0) {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r