public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] TFTP : tftp fix for full volume case
@ 2017-09-25 14:37 Meenakshi Aggarwal
  2017-09-25  9:00 ` Ni, Ruiyu
  2017-09-25 15:06 ` [PATCH v2] " Meenakshi Aggarwal
  0 siblings, 2 replies; 9+ messages in thread
From: Meenakshi Aggarwal @ 2017-09-25 14:37 UTC (permalink / raw)
  To: edk2-devel, ruiyu.ni, jaben.carsey
  Cc: ard.biesheuvel, leif.lindholm, Meenakshi Aggarwal, Udit Kumar,
	Vabhav Sharma

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>
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/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;
     }
 
+    DataSize = FileSize;
     Status = ShellWriteFile (FileHandle, &FileSize, Data);
     if (!EFI_ERROR (Status)) {
       ShellStatus = SHELL_SUCCESS;
@@ -551,7 +553,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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-10 13:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox