From 50668299b34c285f26c6adcd189c95edb620f18f Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Wed, 23 Feb 2022 17:42:01 -0300 Subject: [PATCH] libefivar: Fix iSCSI.Lun byte order issue Obtained from: https://github.com/tianocore/edk2/commit/19f21ed91652d2a5160426ad8ca9219728d85aec Pull Request: https://github.com/freebsd/freebsd-src/pull/581 --- lib/libefivar/efivar-dp-format.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index 8aa8a4798389..bc21ba54a098 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); DevicePathToText protocol as defined in the UEFI 2.0 specification. (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
-Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2018, 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 @@ -1601,18 +1601,20 @@ DevPathToTextiSCSI ( { ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath; UINT16 Options; + UINTN Index; ISCSIDevPath = DevPath; UefiDevicePathLibCatPrint ( Str, - "iSCSI(%s,0x%x,0x%lx,", + "iSCSI(%s,0x%x,0x", ISCSIDevPath->TargetName, - ISCSIDevPath->TargetPortalGroupTag, - ISCSIDevPath->Lun + ISCSIDevPath->TargetPortalGroupTag ); - + for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) / sizeof (UINT8); Index++) { + UefiDevicePathLibCatPrint (Str, "%02x", ((UINT8 *)&ISCSIDevPath->Lun)[Index]); + } Options = ISCSIDevPath->LoginOption; - UefiDevicePathLibCatPrint (Str, "%s,", (((Options >> 1) & 0x0001) != 0) ? "CRC32C" : "None"); + UefiDevicePathLibCatPrint (Str, ",%s,", (((Options >> 1) & 0x0001) != 0) ? "CRC32C" : "None"); UefiDevicePathLibCatPrint (Str, "%s,", (((Options >> 3) & 0x0001) != 0) ? "CRC32C" : "None"); if (((Options >> 11) & 0x0001) != 0) { UefiDevicePathLibCatPrint (Str, "%s,", "None"); -- 2.39.5