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.20; helo=mga02.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 8CA7E21E43B43 for ; Mon, 25 Sep 2017 01:57:34 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2017 02:00:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,435,1500966000"; d="scan'208";a="155599031" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 25 Sep 2017 02:00:44 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 02:00:44 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 02:00:44 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Mon, 25 Sep 2017 17:00:42 +0800 From: "Ni, Ruiyu" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Carsey, Jaben" CC: "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" , "Fu, Siyuan" , "Ye, Ting" Thread-Topic: [edk2] [PATCH] TFTP : tftp fix for full volume case Thread-Index: AQHTNdsthOaACHhrik6/r60LOtQtwaLFTb7A Date: Mon, 25 Sep 2017 09:00:41 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA68613@SHSMSX103.ccr.corp.intel.com> References: <1506350249-28082-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: <1506350249-28082-1-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] TFTP : tftp fix for full volume case X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 08:57:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable + Siyuan and Ting. -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Meen= akshi Aggarwal Sent: Monday, September 25, 2017 10:37 PM To: edk2-devel@lists.01.org; Ni, Ruiyu ; Carsey, Jaben = Cc: leif.lindholm@linaro.org; ard.biesheuvel@linaro.org Subject: [edk2] [PATCH] TFTP : tftp fix for full volume case Issue : When storage media is full, tftp was resulting in ASSERT MdeModulePkg/Core/= Dxe/Mem/Page.c, because number of pages was zero. Reason: While doing tftp, function call ShellWriteFile was modifying FileSize varia= ble. In case of full disk it was coming out to be Zero. Fix: Storage the original filesize in local variable, and use this variable whil= e freeing the pages. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar Signed-off-by: Meenakshi Aggarwal Signed-off-by: Vabhav Sharma --- ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Lib= rary/UefiShellTftpCommandLib/Tftp.c index 5c50797..fae8a69 100755 --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c @@ -284,6 +284,7 @@ ShellCommandRunTftp ( EFI_HANDLE Mtftp4ChildHandle; EFI_MTFTP4_PROTOCOL *Mtftp4; UINTN FileSize; + UINTN DataSize; VOID *Data; SHELL_FILE_HANDLE FileHandle; UINT16 BlockSize; @@ -537,6 +538,7 @@ ShellCommandRunTftp ( goto NextHandle; } =20 + DataSize =3D FileSize; Status =3D ShellWriteFile (FileHandle, &FileSize, Data); if (!EFI_ERROR (Status)) { ShellStatus =3D SHELL_SUCCESS; @@ -551,7 +553,7 @@ ShellCommandRunTftp ( NextHandle: =20 if (Data !=3D NULL) { - gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data, EFI_SIZE_TO_PAGES= (FileSize)); + gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Data,=20 + EFI_SIZE_TO_PAGES (DataSize)); } =20 CloseProtocolAndDestroyServiceChild ( -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel