From nobody Mon Dec 23 05:24:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152005384649894.66088118818368; Fri, 2 Mar 2018 21:10:46 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9698D22436925; Fri, 2 Mar 2018 21:04:34 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 8E79421E082BD for ; Fri, 2 Mar 2018 21:04:33 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 21:10:43 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.44]) by orsmga003.jf.intel.com with ESMTP; 02 Mar 2018 21:10:41 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,415,1515484800"; d="scan'208";a="32074736" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Sat, 3 Mar 2018 13:10:39 +0800 Message-Id: <20180303051039.158176-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 Subject: [edk2] [PATCH v2] MdePkg/DevicePathFromText: Fix byte orders of iSCSI.Lun X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jie Lin , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Per UEFI spec, iSCSI.Lun is a 8-byte array with byte #0 in the left. It means "0102030405060708" should be converted to: UINT8[8] =3D {01, 02, 03, 04, 05, 06, 07, 08} or UINT64 =3D {0807060504030201} Today's implementation wrongly uses the reversed order. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jie Lin Cc: Liming Gao Cc: Yonghong Zhu Reviewed-by: Liming Gao --- MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg= /Library/UefiDevicePathLib/DevicePathFromText.c index c66b77ba6c..35a73e83ff 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -2542,6 +2542,7 @@ DevPathFromTextiSCSI ( CHAR16 *ProtocolStr; CHAR8 *AsciiStr; ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; + UINT64 Lun; =20 NameStr =3D GetNextParamStr (&TextDeviceNode); PortalGroupStr =3D GetNextParamStr (&TextDeviceNode); @@ -2560,7 +2561,8 @@ DevPathFromTextiSCSI ( StrToAscii (NameStr, &AsciiStr); =20 ISCSIDevPath->TargetPortalGroupTag =3D (UINT16) Strtoi (PortalGroupStr); - Strtoi64 (LunStr, &ISCSIDevPath->Lun); + Strtoi64 (LunStr, &Lun); + WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun)); =20 Options =3D 0x0000; if (StrCmp (HeaderDigestStr, L"CRC32C") =3D=3D 0) { --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel