From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.5696.1575248034855993314 for ; Sun, 01 Dec 2019 16:53:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: zhichao.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2019 16:53:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,267,1571727600"; d="scan'208";a="241740838" Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga002.fm.intel.com with ESMTP; 01 Dec 2019 16:53:53 -0800 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Ray Ni , Linson Augustine Subject: [PATCH] ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line Date: Mon, 2 Dec 2019 08:53:48 +0800 Message-Id: <20191202005348.22208-1-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Linson Augustine Signed-off-by: Zhichao Gao --- 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