[PATCH] uefi: uefidump: fix the Partition Signature length for the HD Media Device Path isn't correct (LP: #1308415)

Ivan Hu ivan.hu at canonical.com
Wed Apr 16 09:17:21 UTC 2014


Partition Signature defined byte length is 16 on UEFI spec., but the partition_signature array is defined only 8 bytes on fwts_uefi.h.
And the uefidump tool of fwts only dump 8 bytes Hard Drive Partition signature information. This patch fixed to dump the 16 bytes signature.

This patch also fixed the missing __attribute__((packed)) for the wts_uefi_fibre_channel_dev_path structure.

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/lib/include/fwts_uefi.h  |    4 ++--
 src/uefi/uefidump/uefidump.c |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
index ebb5bad..da4556e 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -319,7 +319,7 @@ typedef struct {
 	uint32_t reserved;
 	uint64_t wwn;
 	uint64_t lun;
-} fwts_uefi_fibre_channel_dev_path;
+} __attribute__((packed)) fwts_uefi_fibre_channel_dev_path;
 
 typedef struct {
 	fwts_uefi_dev_path dev_path;
@@ -468,7 +468,7 @@ typedef struct {
 	uint32_t partition_number;
 	uint64_t partition_start;
 	uint64_t partition_size;
-	uint8_t partition_signature[8];
+	uint8_t partition_signature[16];
 	uint8_t mbr_type;
 	uint8_t signature_type;
 } __attribute__((packed)) fwts_uefi_hard_drive_dev_path;
diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 50d47e1..e17731f 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -464,6 +464,7 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				fwts_uefi_hard_drive_dev_path *h = (fwts_uefi_hard_drive_dev_path*)dev_path;
 				path = uefidump_vprintf(path, "\\HARDDRIVE("
 				"%" PRIu32 ",%" PRIx64 ",%" PRIx64 ","
+				"%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8
 				"%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 "%02" PRIx8 ","
 				"%" PRIx8 ",%" PRIx8 ")",
 				h->partition_number,
@@ -473,6 +474,10 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c
 				h->partition_signature[2], h->partition_signature[3],
 				h->partition_signature[4], h->partition_signature[5],
 				h->partition_signature[6], h->partition_signature[7],
+				h->partition_signature[8], h->partition_signature[9],
+				h->partition_signature[10], h->partition_signature[11],
+				h->partition_signature[12], h->partition_signature[13],
+				h->partition_signature[14], h->partition_signature[15],
 				h->mbr_type, h->signature_type);
 			}
 			break;
-- 
1.7.9.5




More information about the fwts-devel mailing list