From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Mon, 06 May 2019 07:02:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 May 2019 07:02:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,438,1549958400"; d="scan'208";a="229923951" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 06 May 2019 07:02:23 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 6 May 2019 07:02:22 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 6 May 2019 07:02:22 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.10]) with mapi id 14.03.0415.000; Mon, 6 May 2019 22:02:19 +0800 From: "Ni, Ray" To: "jwatt@jwatt.org" , "devel@edk2.groups.io" CC: "Carsey, Jaben" , "Bi, Dandan" Subject: Re: [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option Thread-Topic: [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option Thread-Index: AQHVBAwhkFtEdfFLEEas9zufo13KOqZeIHXA Date: Mon, 6 May 2019 14:02:20 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C12C3EF@SHSMSX104.ccr.corp.intel.com> References: <20190506130257.80722-1-jwatt@jwatt.org> <20190506130257.80722-2-jwatt@jwatt.org> In-Reply-To: <20190506130257.80722-2-jwatt@jwatt.org> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjczNGI4NGUtNTQwNC00YzgwLWFmM2YtNzlhMDc5ZjI0NjI4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZnRVWXpEUWFPTU9oYW9cLzRneTd4cHB2SFpPd3I3ZDR6alo4RmJndGpLdW9UZjI4WDFIRnp1OWNLWmJVeUpDbHgifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dandan, Can you please help to review? Thanks, Ray > -----Original Message----- > From: jwatt@jwatt.org [mailto:jwatt@jwatt.org] > Sent: Monday, May 6, 2019 9:03 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray > Subject: [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' opti= on >=20 > From: Jonathan Watt >=20 > For all other bcfg commands the "#" (option number) argument(s) are > treated as hexedecimal values regardless of whether or not they are prefi= xed > by "0x". This change fixes '-opt' to handle its "#" > (option number) argument consistently with the other commands. >=20 > Making this change removes a potential footgun whereby a user that has > been using a number without a "0x" prefix with other bcfg commands finds > that, on using that exact same number with '-opt', it has this time > unexpectedly been interpreted as a decimal number and they have modified > (corrupted) an unrelated load option. For example, a user may have been > specifying "10" to other commands to have them act on the 16th option > (because simply "10", without any prefix, is how 'bcfg boot dump' display= ed > the option number for the 16th option). Unfortunately for them, if they a= lso > use '-opt' with "10" it would unexpectedly and inconsistently act on the = 10th > option. >=20 > CC: Jaben Carsey > CC: Ray Ni > Signed-off-by: Jonathan Watt > --- > ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 2 > +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git > a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c > b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c > index d033c7c1dc59..e8b48b4990dd 100644 > --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c > +++ > b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c > @@ -1019,7 +1019,7 @@ BcfgAddOpt( > // > // Get the index of the variable we are changing. > // > - Status =3D ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TR= UE); > + Status =3D ShellConvertStringToUint64(Walker, &Intermediate, TRUE, > + TRUE); > if (EFI_ERROR(Status) || (((UINT16)Intermediate) !=3D Intermediate) || > StrStr(Walker, L" ") =3D=3D NULL || ((UINT16)Intermediate) > > ((UINT16)OrderCount)) { > ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), > gShellBcfgHiiHandle, L"bcfg", L"Option Index"); > ShellStatus =3D SHELL_INVALID_PARAMETER; > -- > 2.21.0