From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 1B51B207E57FD for ; Wed, 12 Apr 2017 00:51:21 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2017 00:51:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,189,1488873600"; d="scan'208";a="76451930" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 12 Apr 2017 00:51:20 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 00:51:20 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 00:51:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.193]) with mapi id 14.03.0319.002; Wed, 12 Apr 2017 15:51:18 +0800 From: "Ye, Ting" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , "Fu, Siyuan" Thread-Topic: [patch] NetworkPkg: Add check logic for iSCSI driver. Thread-Index: AQHSrrPoZv9w+wdDYUqNjLm9aG1CoKHBZagw Date: Wed, 12 Apr 2017 07:51:18 +0000 Message-ID: References: <1491469061-32796-1-git-send-email-lubo.zhang@intel.com> In-Reply-To: <1491469061-32796-1-git-send-email-lubo.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] NetworkPkg: Add check logic for iSCSI driver. 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: Wed, 12 Apr 2017 07:51:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Zhang, Lubo=20 Sent: Thursday, April 06, 2017 4:58 PM To: edk2-devel@lists.01.org Cc: Wu, Jiaxin ; Ye, Ting ; Fu, Siy= uan Subject: [patch] NetworkPkg: Add check logic for iSCSI driver. Need to check variable of mPrivate whether is null before used and redefine= the array length of target address for keyword. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Cc: Wu Jiaxin Cc: Ye Ting Cc: Fu Siyuan --- NetworkPkg/IScsiDxe/IScsiConfig.c | 30 ++++++++++++++----------= ---- NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiC= onfig.c index 56a8685..a588403 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -742,28 +742,28 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword ( ISCSI_CHAP_SECRET_STORAGE ); } } CopyMem(IfrNvData->ISCSIDisplayAttemptList, AttemptNameList, ATTEMPT_N= AME_LIST_SIZE); - } =20 - NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) { - NicInfo =3D NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link); - IScsiMacAddrToStr ( - &NicInfo->PermanentAddress, - NicInfo->HwAddressSize, - NicInfo->VlanId, - MacString - ); - CopyMem ( - IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr), - MacString, - StrLen (MacString) * sizeof (CHAR16) + NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) { + NicInfo =3D NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link); + IScsiMacAddrToStr ( + &NicInfo->PermanentAddress, + NicInfo->HwAddressSize, + NicInfo->VlanId, + MacString ); + CopyMem ( + IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr), + MacString, + StrLen (MacString) * sizeof (CHAR16) + ); =20 - *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) =3D L'/'= ; - } + *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) =3D L'= /'; + } + } } =20 /** Convert the IFR data to iSCSI configuration data. =20 diff --git a/NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h b/NetworkPkg/IScs= iDxe/IScsiConfigNVDataStruc.h index f89f320..22119ad 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h +++ b/NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h @@ -160,11 +160,11 @@ typedef struct { CHAR16 ISCSIIsId[ISID_CONFIGURABLE_STORAGE]; CHAR16 ISCSIInitiatorIpAddress[IP4_STR_MAX_SIZE]; CHAR16 ISCSIInitiatorNetmask[IP4_STR_MAX_SIZE]; CHAR16 ISCSIInitiatorGateway[IP4_STR_MAX_SIZE]; CHAR16 ISCSITargetName[ISCSI_NAME_MAX_SIZE]; - CHAR16 ISCSITargetIpAddress[IP_STR_MAX_SIZE]; + CHAR16 ISCSITargetIpAddress[ISCSI_TARGET_URI_MAX_SIZE]; CHAR16 ISCSILun[ISCSI_LUN_STR_MAX_LEN]; CHAR16 ISCSIChapUsername[ISCSI_CHAP_NAME_STORAGE]; CHAR16 ISCSIChapSecret[ISCSI_CHAP_SECRET_STORAGE]; CHAR16 ISCSIReverseChapUsername[ISCSI_CHAP_NAME_STORAGE]; CHAR16 ISCSIReverseChapSecret[ISCSI_CHAP_SECRET_STORAGE]; -- 1.9.5.msysgit.1