mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
ce8e582c06
commit
5422804653
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
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
|
||||
|
@ -1032,7 +1032,7 @@ EmmcPeimCreateTrb (
|
|||
goto Error;
|
||||
}
|
||||
|
||||
if (Trb->DataLen < Trb->BlockSize) {
|
||||
if ((Trb->DataLen != 0) && (Trb->DataLen < Trb->BlockSize)) {
|
||||
Trb->BlockSize = (UINT16)Trb->DataLen;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
|
||||
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
|
||||
|
@ -1032,7 +1032,7 @@ SdPeimCreateTrb (
|
|||
goto Error;
|
||||
}
|
||||
|
||||
if (Trb->DataLen < Trb->BlockSize) {
|
||||
if ((Trb->DataLen != 0) && (Trb->DataLen < Trb->BlockSize)) {
|
||||
Trb->BlockSize = (UINT16)Trb->DataLen;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue