summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-01-05 09:43:21 +0800
committerHao Wu <hao.a.wu@intel.com>2017-02-21 09:26:08 +0800
commit54228046533720f0e8282be15eea7aafaf0cd0d6 (patch)
tree79587bb4a30e33186783f6947dc13b71e80fc964 /MdeModulePkg/Bus/Pci
parentce8e582c06ef3d82b1df93a7de289ef7d9905c4a (diff)
downloadedk2-54228046533720f0e8282be15eea7aafaf0cd0d6.zip
edk2-54228046533720f0e8282be15eea7aafaf0cd0d6.tar.gz
edk2-54228046533720f0e8282be15eea7aafaf0cd0d6.tar.bz2
MdeModulePkg/SdMmc: Avoid assigning 0 to the BlockSize of Trb
Refine code to avoid potential divide by zero when calculating block number. Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
Diffstat (limited to 'MdeModulePkg/Bus/Pci')
-rw-r--r--MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index ccbf355..aa75aa8 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -4,7 +4,7 @@
It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use.
- Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1265,7 +1265,7 @@ SdMmcCreateTrb (
goto Error;
}
- if (Trb->DataLen < Trb->BlockSize) {
+ if ((Trb->DataLen != 0) && (Trb->DataLen < Trb->BlockSize)) {
Trb->BlockSize = (UINT16)Trb->DataLen;
}