From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 7B32020945BC8 for ; Mon, 25 Sep 2017 17:39:04 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2017 17:42:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,438,1500966000"; d="scan'208";a="903798242" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 25 Sep 2017 17:42:15 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 17:42:15 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 17:42:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Tue, 26 Sep 2017 08:42:12 +0800 From: "Fu, Siyuan" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Ni, Ruiyu" , "Carsey, Jaben" CC: "ard.biesheuvel@linaro.org" , "leif.lindholm@linaro.org" , "Ye, Ting" , Udit Kumar , Vabhav Sharma Thread-Topic: [PATCH v2] TFTP : tftp fix for full volume case Thread-Index: AQHTNd847B1nKc/L/EyoVBE/b8tV0qLGVM3w Date: Tue, 26 Sep 2017 00:42:11 +0000 Message-ID: References: <1506350249-28082-1-git-send-email-meenakshi.aggarwal@nxp.com> <1506351962-28200-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: <1506351962-28200-1-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US 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 v2] 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: Tue, 26 Sep 2017 00:39:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan -----Original Message----- From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com]=20 Sent: Monday, September 25, 2017 11:06 PM To: edk2-devel@lists.01.org; Ni, Ruiyu ; Carsey, Jaben = Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan ; Ye, Ting ; Meenakshi Aggarwal ; Udit Kumar ; Vabhav Sharma Subject: [PATCH v2] 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 variable. In case of full disk it was coming out to be Zero. Fix: Storage the original filesize in local variable, and use this variable while 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 Signed-off-by: Meenakshi Aggarwal --- ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Lib= rary/UefiShellTftpCommandLib/Tftp.c index 5c50797..fbde3bf 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; @@ -294,6 +295,7 @@ ShellCommandRunTftp ( AsciiRemoteFilePath =3D NULL; Handles =3D NULL; FileSize =3D 0; + DataSize =3D 0; BlockSize =3D MTFTP_DEFAULT_BLKSIZE; =20 // @@ -537,6 +539,7 @@ ShellCommandRunTftp ( goto NextHandle; } =20 + DataSize =3D FileSize; Status =3D ShellWriteFile (FileHandle, &FileSize, Data); if (!EFI_ERROR (Status)) { ShellStatus =3D SHELL_SUCCESS; @@ -551,7 +554,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, EFI_SIZE_TO_PAGES= (DataSize)); } =20 CloseProtocolAndDestroyServiceChild ( --=20 1.9.1