From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 ECEB7821E7 for ; Sun, 19 Feb 2017 19:07:21 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2017 19:07:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="50067063" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 19 Feb 2017 19:07:21 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 19 Feb 2017 19:07:21 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 19 Feb 2017 19:07:20 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Mon, 20 Feb 2017 11:07:19 +0800 From: "Tian, Feng" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [PATCH] MdeModulePkg/SdMmc: Avoid assigning 0 to the BlockSize of Trb Thread-Index: AQHSiyZUwZbiTS5UC0aPzKa9PRSnOKFxNodQ Date: Mon, 20 Feb 2017 03:07:18 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699B336E@SHSMSX101.ccr.corp.intel.com> References: <1487559972-50420-1-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1487559972-50420-1-git-send-email-hao.a.wu@intel.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] MdeModulePkg/SdMmc: Avoid assigning 0 to the BlockSize of Trb X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2017 03:07:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian Thanks Feng -----Original Message----- From: Wu, Hao A=20 Sent: Monday, February 20, 2017 11:06 AM To: edk2-devel@lists.01.org Cc: Wu, Hao A ; Tian, Feng Subject: [PATCH] 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 4 ++-- MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c | 4 ++-- MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePk= g/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 @@ =20 It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use. =20 - Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1265,7 +1265,7 @@ SdMmcCreateTrb ( goto Error; } =20 - if (Trb->DataLen < Trb->BlockSize) { + if ((Trb->DataLen !=3D 0) && (Trb->DataLen < Trb->BlockSize)) { Trb->BlockSize =3D (UINT16)Trb->DataLen; } =20 diff --git a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c b/MdeModulePkg/Bu= s/Sd/EmmcBlockIoPei/EmmcHci.c index 5a9e0b2..2c0baca 100644 --- a/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c +++ b/MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHci.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1032,7 +1032,7 @@ EmmcPeimCreateTrb ( goto Error; } =20 - if (Trb->DataLen < Trb->BlockSize) { + if ((Trb->DataLen !=3D 0) && (Trb->DataLen < Trb->BlockSize)) { Trb->BlockSize =3D (UINT16)Trb->DataLen; } =20 diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c b/MdeModulePkg/Bus/Sd= /SdBlockIoPei/SdHci.c index 72efd56..23e6563 100644 --- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c +++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHci.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -1032,7 +1032,7 @@ SdPeimCreateTrb ( goto Error; } =20 - if (Trb->DataLen < Trb->BlockSize) { + if ((Trb->DataLen !=3D 0) && (Trb->DataLen < Trb->BlockSize)) { Trb->BlockSize =3D (UINT16)Trb->DataLen; } =20 -- 1.9.5.msysgit.0