public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs
@ 2013-09-13 10:53 HATAYAMA Daisuke
  2013-09-13 10:53 ` [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation HATAYAMA Daisuke
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: HATAYAMA Daisuke @ 2013-09-13 10:53 UTC (permalink / raw)
  To: kumagai-atsushi; +Cc: kexec

Hello Kumagai-san,

These are fixing the two bugs in printing GUID on sadump format.
Could you apply these?

These patchs are built on top of v1.5.4.

---

HATAYAMA Daisuke (2):
      sadump: correct buffer size for GUID EFI text representation
      sadump: convert the first three fields of EFI GUID from little-endian into big-endian


 sadump_info.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 

Thanks.
HATAYAMA, Daisuke

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation
  2013-09-13 10:53 [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs HATAYAMA Daisuke
@ 2013-09-13 10:53 ` HATAYAMA Daisuke
  2013-09-13 10:53 ` [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian HATAYAMA Daisuke
  2013-09-17  6:20 ` [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs Atsushi Kumagai
  2 siblings, 0 replies; 4+ messages in thread
From: HATAYAMA Daisuke @ 2013-09-13 10:53 UTC (permalink / raw)
  To: kumagai-atsushi; +Cc: kexec

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@jp.fujitsu.com>
---
 sadump_info.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sadump_info.c b/sadump_info.c
index be6cf55..e563180 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -23,6 +23,8 @@
 #include "print_info.h"
 #include "sadump_mod.h"
 
+#define SADUMP_EFI_GUID_TEXT_REPR_LEN 36
+
 #ifdef __x86__
 
 #define KEXEC_NOTE_HEAD_BYTES roundup(sizeof(Elf32_Nhdr), 4)
@@ -427,7 +429,7 @@ read_sadump_header(char *filename)
 	unsigned long bitmap_len, dumpable_bitmap_len;
 	enum sadump_format_type flag_sadump;
 	uint32_t smram_cpu_state_size = 0;
-	char guid[33];
+	char guid[SADUMP_EFI_GUID_TEXT_REPR_LEN+1];
 
 	if ((si->sph_memory = malloc(SADUMP_DEFAULT_BLOCK_SIZE)) == NULL) {
 		ERRMSG("Can't allocate memory for partition header buffer: "
@@ -664,7 +666,7 @@ read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi)
 {
 	struct sadump_part_header *sph = NULL;
 	unsigned long offset = 0;
-	char guid[33];
+	char guid[SADUMP_EFI_GUID_TEXT_REPR_LEN+1];
 
 	if ((sph = malloc(si->sh_memory->block_size)) == NULL) {
 		ERRMSG("Can't allocate memory for partition header buffer. "


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian
  2013-09-13 10:53 [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs HATAYAMA Daisuke
  2013-09-13 10:53 ` [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation HATAYAMA Daisuke
@ 2013-09-13 10:53 ` HATAYAMA Daisuke
  2013-09-17  6:20 ` [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs Atsushi Kumagai
  2 siblings, 0 replies; 4+ messages in thread
From: HATAYAMA Daisuke @ 2013-09-13 10:53 UTC (permalink / raw)
  To: kumagai-atsushi; +Cc: kexec

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@jp.fujitsu.com>
---
 sadump_info.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sadump_info.c b/sadump_info.c
index e563180..84126b1 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -23,6 +23,8 @@
 #include "print_info.h"
 #include "sadump_mod.h"
 
+#include <arpa/inet.h> /* htonl, htons */
+
 #define SADUMP_EFI_GUID_TEXT_REPR_LEN 36
 
 #ifdef __x86__
@@ -334,7 +336,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]);


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs
  2013-09-13 10:53 [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs HATAYAMA Daisuke
  2013-09-13 10:53 ` [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation HATAYAMA Daisuke
  2013-09-13 10:53 ` [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian HATAYAMA Daisuke
@ 2013-09-17  6:20 ` Atsushi Kumagai
  2 siblings, 0 replies; 4+ messages in thread
From: Atsushi Kumagai @ 2013-09-17  6:20 UTC (permalink / raw)
  To: d.hatayama@jp.fujitsu.com; +Cc: kexec@lists.infradead.org

Hello HATAYAMA-san,

(2013/09/13 19:54), HATAYAMA Daisuke wrote:
> Hello Kumagai-san,
>
> These are fixing the two bugs in printing GUID on sadump format.
> Could you apply these?

Sure, I'll merge these into v1.5.5.


Thanks
Atsushi Kumagai

> These patchs are built on top of v1.5.4.
>
> ---
>
> HATAYAMA Daisuke (2):
>        sadump: correct buffer size for GUID EFI text representation
>        sadump: convert the first three fields of EFI GUID from little-endian into big-endian
>
>
>   sadump_info.c |   10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-17  6:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13 10:53 [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs HATAYAMA Daisuke
2013-09-13 10:53 ` [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation HATAYAMA Daisuke
2013-09-13 10:53 ` [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian HATAYAMA Daisuke
2013-09-17  6:20 ` [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs Atsushi Kumagai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox