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 E48E42007D093 for ; Mon, 17 Apr 2017 06:35:01 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2017 06:35:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,215,1488873600"; d="scan'208";a="846833447" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 17 Apr 2017 06:35:01 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 17 Apr 2017 06:35:01 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.246]) by FMSMSX113.amr.corp.intel.com ([169.254.13.235]) with mapi id 14.03.0319.002; Mon, 17 Apr 2017 06:35:01 -0700 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: Michael Turner Thread-Topic: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation Thread-Index: AQHSt0PixW62yJxlHkS07kiMMFgrTaHJkEVA Date: Mon, 17 Apr 2017 13:35:00 +0000 Message-ID: References: <20170417062849.90528-1-ruiyu.ni@intel.com> In-Reply-To: <20170417062849.90528-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation 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: Mon, 17 Apr 2017 13:35:02 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Ni, Ruiyu > Sent: Sunday, April 16, 2017 11:29 PM > To: edk2-devel@lists.01.org > Cc: Michael Turner ; Carsey, Jaben > > Subject: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory > reallocation > Importance: High >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Michael Turner > Cc: Jaben Carsey > --- > ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c > b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c > index 09f2c56..3b13e62 100755 > --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c > +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c > @@ -1,7 +1,7 @@ > /** @file > Main file for support of shell consist mapping. >=20 > - Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
> + Copyright (c) 2005 - 2017, Intel Corporation. All rights > + reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may = be found > at @@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName ( > DEVICE_CONSIST_MAPPING_INFO MappingInfo; > EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; > UINTN Index; > - CHAR16 *NewStr; >=20 > ASSERT(DevicePath !=3D NULL); > ASSERT(Table !=3D NULL); > @@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName ( > return NULL; > } >=20 > - NewStr =3D ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * = sizeof > (CHAR16), Str.Str); > - if (NewStr =3D=3D NULL) { > - SHELL_FREE_NON_NULL (Str.Str); > - return (NULL); > - } > - NewStr[Str.Len] =3D CHAR_NULL; > - return NewStr; > + return Str.Str; > } >=20 > /** > -- > 2.9.0.windows.1