public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Fu, Siyuan" <siyuan.fu@intel.com>
To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"Carsey, Jaben" <jaben.carsey@intel.com>
Cc: "ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	"leif.lindholm@linaro.org" <leif.lindholm@linaro.org>,
	"Ye, Ting" <ting.ye@intel.com>, Udit Kumar <udit.kumar@nxp.com>,
	Vabhav Sharma <vabhav.sharma@nxp.com>
Subject: Re: [PATCH v2] TFTP : tftp fix for full volume case
Date: Tue, 26 Sep 2017 00:42:11 +0000	[thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B3C2601@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1506351962-28200-1-git-send-email-meenakshi.aggarwal@nxp.com>

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

-----Original Message-----
From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] 
Sent: Monday, September 25, 2017 11:06 PM
To: edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Fu, Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>; Udit Kumar <udit.kumar@nxp.com>; Vabhav Sharma <vabhav.sharma@nxp.com>
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 <udit.kumar@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/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 = NULL;
   Handles             = NULL;
   FileSize            = 0;
+  DataSize            = 0;
   BlockSize           = MTFTP_DEFAULT_BLKSIZE;
 
   //
@@ -537,6 +539,7 @@ ShellCommandRunTftp (
       goto NextHandle;
     }
 
+    DataSize = FileSize;
     Status = ShellWriteFile (FileHandle, &FileSize, Data);
     if (!EFI_ERROR (Status)) {
       ShellStatus = SHELL_SUCCESS;
@@ -551,7 +554,7 @@ ShellCommandRunTftp (
     NextHandle:
 
     if (Data != 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));
     }
 
     CloseProtocolAndDestroyServiceChild (
-- 
1.9.1



  reply	other threads:[~2017-09-26  0:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 14:37 [PATCH] TFTP : tftp fix for full volume case Meenakshi Aggarwal
2017-09-25  9:00 ` Ni, Ruiyu
2017-09-25 15:06 ` [PATCH v2] " Meenakshi Aggarwal
2017-09-26  0:42   ` Fu, Siyuan [this message]
2017-09-27  3:31     ` Meenakshi Aggarwal
2017-10-09  6:28       ` Meenakshi Aggarwal
2017-10-09 14:13         ` Carsey, Jaben
2017-10-10  5:22           ` Ni, Ruiyu
2017-10-10 13:54             ` Meenakshi Aggarwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B1FF2E9001CE9041BD10B825821D5BC58B3C2601@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox