From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.44383.1584927634826945980 for ; Sun, 22 Mar 2020 18:40:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: guomin.jiang@intel.com) IronPort-SDR: TuLyF3R7P4UGffTBVictbU55te5D8Oro/h1fwJw6xompvF1/QNbSm4WQZ7Hzs0Z9E5XuOp9PgN WkbMCkXOTS6g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2020 18:40:33 -0700 IronPort-SDR: 06PdbmBWQWuHt5KY7C9zxdN2L5PLytDSNbi1HYXUImv1LhFraBbWUTTQ9n8SDMlnex2Evww0b8 jfLcIktCVtiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,294,1580803200"; d="scan'208";a="239268325" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 22 Mar 2020 18:40:33 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 18:40:33 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 18:40:33 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.232]) with mapi id 14.03.0439.000; Mon, 23 Mar 2020 09:40:31 +0800 From: "Guomin Jiang" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Justen, Jordan L" , Andrew Fish Subject: Re: [PATCH] EmulatorPkg/WinHost: Add EFI_BUFFER_TOO_SMALL for return status. Thread-Topic: [PATCH] EmulatorPkg/WinHost: Add EFI_BUFFER_TOO_SMALL for return status. Thread-Index: AQHV/oSYCxN/pIaaukGrLKbzWUppMqhRD93wgAAQ1IA= Date: Mon, 23 Mar 2020 01:40:30 +0000 Message-ID: References: <20200320065543.602-1-guomin.jiang@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C4A2AB8@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C4A2AB8@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: guomin.jiang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, I have review the UEFI spec and code, the logic is ok, it my mistake. In my test, I pass the *BufferSize with 0, but it is unexpected input value= . Sorry for it. > -----Original Message----- > From: Ni, Ray > Sent: Friday, March 20, 2020 3:12 PM > To: Jiang, Guomin ; devel@edk2.groups.io > Cc: Justen, Jordan L ; Andrew Fish > > Subject: RE: [PATCH] EmulatorPkg/WinHost: Add EFI_BUFFER_TOO_SMALL > for return status. >=20 > Guomin, > It's OK to do a partial read. There is no requirement for a single read t= hat > returns all the file content back to caller. >=20 > Some comments to your commit message: > Besides, the commit message is too simple. It should indicate what was > wrong in the code and what's your expected behavior. >=20 > The Bugzilla comments are very detailed actually. >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: Jiang, Guomin > > Sent: Friday, March 20, 2020 2:56 PM > > To: devel@edk2.groups.io > > Cc: Justen, Jordan L ; Andrew Fish > > ; Ni, Ray > > Subject: [PATCH] EmulatorPkg/WinHost: Add EFI_BUFFER_TOO_SMALL for > > return status. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2605 > > > > I think it is necessary that check the buffer size before ReadFile, it > > will inform the caller that they should provide more buffer. > > > > Cc: Jordan Justen > > Cc: Andrew Fish > > Cc: Ray Ni > > Signed-off-by: Guomin Jiang > > --- > > EmulatorPkg/Win/Host/WinFileSystem.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/EmulatorPkg/Win/Host/WinFileSystem.c > > b/EmulatorPkg/Win/Host/WinFileSystem.c > > index f6b06b1c92..6fb86db6b3 100644 > > --- a/EmulatorPkg/Win/Host/WinFileSystem.c > > +++ b/EmulatorPkg/Win/Host/WinFileSystem.c > > @@ -1159,6 +1159,12 @@ WinNtFileRead ( > > } > > > > } > > > > > > > > + if (FileSize > *BufferSize) { > > > > + Status =3D EFI_BUFFER_TOO_SMALL; > > > > + *BufferSize =3D FileSize; > > > > + goto Done; > > > > + } > > > > + > > > > Status =3D ReadFile ( > > > > PrivateFile->LHandle, > > > > Buffer, > > > > -- > > 2.25.1.windows.1