Reviewed by Linson Augustine <linson.august...@intel.com>

Regards,
Linson.

-----Original Message-----
From: Gao, Zhichao <zhichao....@intel.com> 
Sent: Monday, December 2, 2019 6:24 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray...@intel.com>; Augustine, Linson <linson.august...@intel.com>
Subject: [PATCH] ShellPkg/ShellProtocol: Return error code while fail parsing 
cmd-line

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2395

Errors happened in the arguments parsing is not a critical error.
And it would miss the error status code in the release version of shell.
So replace the ASSERT with returning error status code while fail parsing 
command-line in UpdateArgcArgv.

Cc: Ray Ni <ray...@intel.com>
Cc: Linson Augustine <linson.august...@intel.com>
Signed-off-by: Zhichao Gao <zhichao....@intel.com>
---
 ShellPkg/Application/Shell/ShellProtocol.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Application/Shell/ShellProtocol.c 
b/ShellPkg/Application/Shell/ShellProtocol.c
index 5e529b6568..f0362a42d8 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -1497,7 +1497,10 @@ InternalShellExecuteDevicePath(
     ShellParamsProtocol.StdOut  = 
ShellInfoObject.NewShellParametersProtocol->StdOut;
     ShellParamsProtocol.StdErr  = 
ShellInfoObject.NewShellParametersProtocol->StdErr;
     Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, 
NULL, NULL);
-    ASSERT_EFI_ERROR(Status);
+    if (EFI_ERROR (Status)) {
+      goto UnloadImage;
+    }
+
     //
     // Replace Argv[0] with the full path of the binary we're executing:
     // If the command line was "foo", the binary might be called "foo.efi".
--
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51534): https://edk2.groups.io/g/devel/message/51534
Mute This Topic: https://groups.io/mt/64492759/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to