From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 8658C21BBC436 for ; Thu, 22 Jun 2017 01:09:47 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2017 01:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,372,1493708400"; d="scan'208";a="117908667" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 22 Jun 2017 01:11:12 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 22 Jun 2017 01:11:11 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 22 Jun 2017 01:11:11 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.151]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.122]) with mapi id 14.03.0319.002; Thu, 22 Jun 2017 16:11:09 +0800 From: "Ni, Ruiyu" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg DmpStore: Make NameSize to be consistent with name buffer Thread-Index: AQHS6yid5B0SbnZxTUaAHuNk2ra79aIwh85g Date: Thu, 22 Jun 2017 08:11:08 +0000 Deferred-Delivery: Thu, 22 Jun 2017 08:11:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B9A0006@SHSMSX104.ccr.corp.intel.com> References: <1498116265-150004-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1498116265-150004-1-git-send-email-star.zeng@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg DmpStore: Make NameSize to be consistent with name buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 08:09:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Zeng, Star > Sent: Thursday, June 22, 2017 3:24 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Ni, Ruiyu ; > Carsey, Jaben > Subject: [PATCH] ShellPkg DmpStore: Make NameSize to be consistent with > name buffer >=20 > Current code will allocate pool to hold the null char for name buffer > when PrevName=3D=3DNULL, but the NameSize is still 0. >=20 > For this case, GetNextVariableName will return EFI_INVALID_PARAMETER > to follow UEFI 2.7 spec. >=20 > UEFI 2.7 spec: > The VariableNameSize must not be smaller the size of the variable > name string passed to GetNextVariableName() on input in the > VariableName buffer. >=20 > EFI_INVALID_PARAMETER > Null-terminator is not found in the first VariableNameSize bytes of > the input VariableName buffer. >=20 > This patch is to make NameSize to be consistent with name buffer. >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c > b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c > index 23db54553f11..aeffc89b1991 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c > @@ -436,6 +436,7 @@ CascadeProcessVariables ( > StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0); > } else { > FoundVarName =3D AllocateZeroPool(sizeof(CHAR16)); > + NameSize =3D sizeof(CHAR16); > } >=20 > Status =3D gRT->GetNextVariableName (&NameSize, FoundVarName, > &FoundVarGuid); > -- > 2.7.0.windows.1