public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Tftp assert fix for openfile failure case
@ 2017-11-03 14:26 Vabhav
  2017-11-07 17:54 ` Leif Lindholm
  0 siblings, 1 reply; 10+ messages in thread
From: Vabhav @ 2017-11-03 14:26 UTC (permalink / raw)
  To: edk2-devel, ruiyu.ni, jaben.carsey
  Cc: ard.biesheuvel, leif.lindholm, siyuan.fu, ting.ye, Vabhav,
	Udit Kumar

Issue:
when file open is failed, assert was seen due to freeing 0 size page

Reason:
DataSize is remain zero if error is reported in ShellOpenFileByName

Fix:
Update DataSize as soon as FileSize is available

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Vabhav <vabhav.sharma@nxp.com>
---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
index fbde3bf..6425fc5 100755
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -509,6 +509,7 @@ ShellCommandRunTftp (
       );
       goto NextHandle;
     }
+    DataSize = FileSize;
 
     Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, &Data);
     if (EFI_ERROR (Status)) {
@@ -539,7 +540,6 @@ ShellCommandRunTftp (
       goto NextHandle;
     }
 
-    DataSize = FileSize;
     Status = ShellWriteFile (FileHandle, &FileSize, Data);
     if (!EFI_ERROR (Status)) {
       ShellStatus = SHELL_SUCCESS;
-- 
1.9.1



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

end of thread, other threads:[~2018-02-20  6:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 14:26 [PATCH] Tftp assert fix for openfile failure case Vabhav
2017-11-07 17:54 ` Leif Lindholm
2017-11-08  5:15   ` Udit Kumar
2017-11-08 15:22     ` Leif Lindholm
2017-11-09  4:43       ` Udit Kumar
2018-02-13  9:43         ` Meenakshi Aggarwal
2018-02-13 15:14           ` Carsey, Jaben
2018-02-13 15:19             ` Meenakshi Aggarwal
2018-02-13 15:36               ` Carsey, Jaben
2018-02-20  6:19                 ` Meenakshi Aggarwal

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