Hello Dave, These patches fix two bugs on sadump format in printing GUID during help -D. Could you apply these patches? These are based on crash-7.0.2. -- Thanks. HATAYAMA, Daisuke
From 6bbb9b7ec0c9e138815b2e20efa4c7e141e6c733 Mon Sep 17 00:00:00 2001 From: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx> Date: Fri, 13 Sep 2013 16:06:55 +0900 Subject: [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation While GUID EFI text representaion needs 36 bytes, all the buffers for GUID EFI passed to guid_to_str() are of 33 bytes, due to which last three characters in GUID are not displayed now. This patch increases buffer size from 33 bytes to 36 bytes and make GUID fully visible. Signed-off-by: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx> --- sadump.c | 8 +++++--- sadump.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sadump.c b/sadump.c index 93799bc..5af29ad 100644 --- a/sadump.c +++ b/sadump.c @@ -127,7 +127,8 @@ read_dump_header(char *file) uint32_t smram_cpu_state_size = 0; ulong bitmap_len, dumpable_bitmap_len; char *bitmap = NULL, *dumpable_bitmap = NULL, *page_buf = NULL; - char guid1[33], guid2[33]; + char guid1[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; + char guid2[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; sph = malloc(block_size); if (!sph) { @@ -468,7 +469,8 @@ add_disk(char *file) struct sadump_part_header *ph; struct sadump_diskset_data *this_disk; int diskid; - char guid1[33], guid2[33]; + char guid1[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; + char guid2[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; diskid = sd->sd_list_len - 1; this_disk = sd->sd_list[diskid]; @@ -905,7 +907,7 @@ int sadump_memory_dump(FILE *fp) struct sadump_header *sh; struct sadump_media_header *smh; int i, others; - char guid[33]; + char guid[SADUMP_EFI_GUID_TEXT_REPR_LEN+1]; fprintf(fp, "sadump_data: \n"); fprintf(fp, " filename: %s\n", sd->filename); diff --git a/sadump.h b/sadump.h index 29dce06..09e313e 100644 --- a/sadump.h +++ b/sadump.h @@ -41,6 +41,8 @@ typedef struct { uint8_t data4[8]; } efi_guid_t; +#define SADUMP_EFI_GUID_TEXT_REPR_LEN 36 + struct sadump_part_header { #define SADUMP_SIGNATURE1 0x75646173 #define SADUMP_SIGNATURE2 0x0000706d -- 1.8.3.1
From 88c16ab5e40aafdfa8ae4d36c70089746d77747b Mon Sep 17 00:00:00 2001 From: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx> Date: Fri, 13 Sep 2013 16:20:46 +0900 Subject: [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian Although RFC 4122 recommends network byte order for all fields of UUID, EFI GUID uses little-endian for the first three fields TimeLow, TimeMid and TimeHighAndVersion. Thus, in text representation of the GUID, converting the three fields from little-endian into big-endian is needed. Signed-off-by: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx> --- sadump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sadump.c b/sadump.c index 5af29ad..6972b1c 100644 --- a/sadump.c +++ b/sadump.c @@ -18,6 +18,7 @@ #include "defs.h" #include "sadump.h" +#include <arpa/inet.h> /* htonl, htons */ #include <elf.h> enum { @@ -865,7 +866,7 @@ guid_to_str(efi_guid_t *guid, char *buf, size_t buflen) { snprintf(buf, buflen, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->data1, guid->data2, guid->data3, + htonl(guid->data1), htons(guid->data2), htons(guid->data3), guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3], guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); -- 1.8.3.1
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility