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 9598720945B6D for ; Mon, 18 Sep 2017 21:15:02 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2017 21:18:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,416,1500966000"; d="scan'208";a="1015941522" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 18 Sep 2017 21:18:05 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 21:18:06 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 21:18:05 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Tue, 19 Sep 2017 12:18:04 +0800 From: "Fu, Siyuan" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" Thread-Topic: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Thread-Index: AQHTMOyws4Ds054ZxkeTa1jSEBdmbqK7mrBQ Date: Tue, 19 Sep 2017 04:18:03 +0000 Message-ID: References: <20170919021157.15996-1-hao.a.wu@intel.com> In-Reply-To: <20170919021157.15996-1-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen 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: Tue, 19 Sep 2017 04:15:02 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan -----Original Message----- From: Wu, Hao A=20 Sent: Tuesday, September 19, 2017 10:12 AM To: edk2-devel@lists.01.org Cc: Wu, Hao A ; Fu, Siyuan ; Wu, J= iaxin Subject: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen The commits ultilizes a local variable to store the length of a string which will be used right after. Cc: Fu Siyuan Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- NetworkPkg/IScsiDxe/IScsiConfig.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiC= onfig.c index c0dd305ecf..52e51d6b31 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -766,8 +766,10 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword ( =20 *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) =3D L'= /'; } - if (StrLen (IfrNvData->ISCSIMacAddr) !=3D 0) { - *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr) - 1) = =3D L'\0'; + + StringLen =3D StrLen (IfrNvData->ISCSIMacAddr); + if (StringLen > 0) { + *(IfrNvData->ISCSIMacAddr + StringLen - 1) =3D L'\0'; } } } --=20 2.12.0.windows.1