From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AEA8E820A4 for ; Fri, 10 Feb 2017 20:35:36 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2017 20:35:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,144,1484035200"; d="scan'208";a="63390260" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 10 Feb 2017 20:35:36 -0800 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 10 Feb 2017 20:35:36 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 10 Feb 2017 20:35:35 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.59]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Sat, 11 Feb 2017 12:35:33 +0800 From: "Ni, Ruiyu" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] ShellPkg/pci: Report error when invalid value is specified for "-ec" Thread-Index: AQHSg7/42FIoeOfzLkSQSRoeXFMMt6FjOKqQ Date: Sat, 11 Feb 2017 04:35:32 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B89F552@SHSMSX104.ccr.corp.intel.com> References: <20170210082335.91020-1-ruiyu.ni@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTM4N2ZiNjItODYyOS00ZGUzLWE0NGUtZjAyMDkwZjg2YzU3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkF0WG1MaFhYNFhnTWFBU2l3UU5Ca3dyZWZqTkxQKzFrU3lkSDJGalRtTEU9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/pci: Report error when invalid value is specified for "-ec" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2017 04:35:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jaben, "-ec" should be followed by a ID. The patch fixes when "-ec" is followed by string other than ID, no error is= reported. Regards, Ray >-----Original Message----- >From: Carsey, Jaben >Sent: Saturday, February 11, 2017 1:06 AM >To: Ni, Ruiyu ; edk2-devel@lists.01.org >Cc: Carsey, Jaben >Subject: RE: [PATCH] ShellPkg/pci: Report error when invalid value is spec= ified for "-ec" > >Reviewed-by: Jaben Carsey > >Ray, > >What is the intended behavior if the user does -ec with no data after it? > >-Jaben > > >> -----Original Message----- >> From: Ni, Ruiyu >> Sent: Friday, February 10, 2017 12:24 AM >> To: edk2-devel@lists.01.org >> Cc: Carsey, Jaben >> Subject: [PATCH] ShellPkg/pci: Report error when invalid value is specif= ied >> for "-ec" >> Importance: High >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ruiyu Ni >> Cc: Jaben Carsey >> --- >> ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 21 >> +++++++++++++++------ >> .../UefiShellDebug1CommandsLib.uni | 2 +- >> 2 files changed, 16 insertions(+), 7 deletions(-) >> >> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c >> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c >> index fb7561f..37f15d6 100644 >> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c >> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c >> @@ -2726,6 +2726,7 @@ ShellCommandRunPci ( >> Bus =3D 0; >> Device =3D 0; >> Func =3D 0; >> + EnhancedDump =3D 0xFFFF; >> if (ShellCommandLineGetFlag(Package, L"-i")) { >> ExplainData =3D TRUE; >> } >> @@ -2807,6 +2808,20 @@ ShellCommandRunPci ( >> } >> } >> >> + Temp =3D ShellCommandLineGetValue (Package, L"-ec"); >> + if (Temp !=3D NULL) { >> + // >> + // Input converted to hexadecimal number. >> + // >> + if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, >> TRUE))) { >> + EnhancedDump =3D (UINT16) RetVal; >> + } else { >> + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN >> (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); >> + ShellStatus =3D SHELL_INVALID_PARAMETER; >> + goto Done; >> + } >> + } >> + >> // >> // Find the protocol interface who's in charge of current segment, = and its >> // bus range covers the current bus >> @@ -2883,12 +2898,6 @@ ShellCommandRunPci ( >> // If "-i" appears in command line, interpret data in configuration= space >> // >> if (ExplainData) { >> - EnhancedDump =3D 0xFFFF; >> - if (ShellCommandLineGetFlag(Package, L"-ec")) { >> - Temp =3D ShellCommandLineGetValue(Package, L"-ec"); >> - ASSERT (Temp !=3D NULL); >> - EnhancedDump =3D (UINT16) ShellHexStrToUintn (Temp); >> - } >> Status =3D PciExplainData (&ConfigSpace, Address, IoDev, Enhanced= Dump); >> } >> } >> diff --git >> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman >> dsLib.uni >> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman >> dsLib.uni >> index 8ea4215..7c0ca98 100644 >> --- >> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman >> dsLib.uni >> +++ >> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman >> dsLib.uni >> @@ -39,7 +39,7 @@ >> #string STR_GEN_PCIRBIO_NF #language en-US "%H%s%N: Protocol - >> PciRootBridgeIo not found.\r\n" >> #string STR_GEN_PCIRBIO_ER #language en-US "%H%s%N: Problem >> accessing the data using Protocol - PciRootBridgeIo\r\n" >> #string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid >> argument - '%H%s%N'\r\n" >> -#string STR_GEN_PARAM_INV_HEX #language en-US "%H%s%N: Invalid >> parameter - '%H%s%N:'. Must be hexadecimal.\r\n" >> +#string STR_GEN_PARAM_INV_HEX #language en-US "%H%s%N: Invalid >> parameter - '%H%s%N'. Must be hexadecimal.\r\n" >> #string STR_GEN_PARAM_CONFLICT #language en-US "%H%s%N: Flags >> conflict with - '%H%s%N' and '%H%s%N'\r\n" >> #string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory >> allocation was not successful.\r\n" >> #string STR_GEN_MAP_PROTOCOL #language en-US "%H%s%N: Mapped >> device '%B%s%N' does not have protocol %B%s%N\r\n" >> -- >> 2.9.0.windows.1