From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 1997821B02822 for ; Mon, 15 Oct 2018 04:31:58 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 04:31:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,384,1534834800"; d="scan'208";a="92072863" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 15 Oct 2018 04:31:58 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Oct 2018 04:31:58 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Oct 2018 04:31:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.48]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.245]) with mapi id 14.03.0319.002; Mon, 15 Oct 2018 19:31:55 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 06/11] SourceLevelDebugPkg/Usb3: Make sure data from HW can fit in buffer Thread-Index: AQHUZFGiROdQ+gzdn0yjkFGSfk1sIKUgLKqQ Date: Mon, 15 Oct 2018 11:31:55 +0000 Message-ID: References: <20181015063833.61304-1-ruiyu.ni@intel.com> <20181015063833.61304-7-ruiyu.ni@intel.com> In-Reply-To: <20181015063833.61304-7-ruiyu.ni@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 06/11] SourceLevelDebugPkg/Usb3: Make sure data from HW can fit in buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2018 11:31:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, October 15, 2018 2:38 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [PATCH 06/11] SourceLevelDebugPkg/Usb3: Make sure data from > HW can fit in buffer >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Hao A Wu > --- > .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c | > 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugComm > unicationLibUsb3Transfer.c > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugComm > unicationLibUsb3Transfer.c > index fb48010a9a..fda43279a3 100644 > --- > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugComm > unicationLibUsb3Transfer.c > +++ > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugComm > unicationLibUsb3Transfer.c > @@ -556,6 +556,13 @@ XhcDataTransfer ( >=20 > XhcExecTransfer (Handle, Urb, Timeout); >=20 > + // > + // Make sure the data received from HW can fit in the received buffer. > + // > + if (Urb->Completed > *DataLength) { > + return EFI_DEVICE_ERROR; > + } > + > *DataLength =3D Urb->Completed; >=20 > Status =3D EFI_TIMEOUT; > -- > 2.16.1.windows.1