public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Vabhav <vabhav.sharma@nxp.com>
To: <edk2-devel@lists.01.org>, <ruiyu.ni@intel.com>,
	<jaben.carsey@intel.com>
Cc: <ard.biesheuvel@linaro.org>, <leif.lindholm@linaro.org>,
	<siyuan.fu@intel.com>, <ting.ye@intel.com>,
	Vabhav <vabhav.sharma@nxp.com>, Udit Kumar <udit.kumar@nxp.com>
Subject: [PATCH] Tftp assert fix for openfile failure case
Date: Fri, 3 Nov 2017 19:56:32 +0530	[thread overview]
Message-ID: <1509719192-16582-1-git-send-email-vabhav.sharma@nxp.com> (raw)

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



             reply	other threads:[~2017-11-03  8:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 14:26 Vabhav [this message]
2017-11-07 17:54 ` [PATCH] Tftp assert fix for openfile failure case 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

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=1509719192-16582-1-git-send-email-vabhav.sharma@nxp.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