From 8502fbca04b326294fa5d2b7521703757a8b046a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 14 Jan 2012 23:36:21 +0100 Subject: [PATCH] * grub-core/fs/reiserfs.c (grub_reiserfs_uuid): Reject 0-uuid as created when no uuid support is compiled into mkfs.reiser. --- ChangeLog | 5 +++++ grub-core/fs/reiserfs.c | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 391890587..da6be5aad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-01-14 Vladimir Serbinenko + + * grub-core/fs/reiserfs.c (grub_reiserfs_uuid): Reject 0-uuid as + created when no uuid support is compiled into mkfs.reiser. + 2012-01-14 Vladimir Serbinenko * grub-core/fs/hfs.c (macroman_to_utf8): Convert / to :. diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c index 639de8d74..82541210d 100644 --- a/grub-core/fs/reiserfs.c +++ b/grub-core/fs/reiserfs.c @@ -1351,21 +1351,25 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid) grub_dl_ref (my_mod); + *uuid = NULL; data = grub_reiserfs_mount (disk); if (data) { - *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", - grub_be_to_cpu16 (data->superblock.uuid[0]), - grub_be_to_cpu16 (data->superblock.uuid[1]), - grub_be_to_cpu16 (data->superblock.uuid[2]), - grub_be_to_cpu16 (data->superblock.uuid[3]), - grub_be_to_cpu16 (data->superblock.uuid[4]), - grub_be_to_cpu16 (data->superblock.uuid[5]), - grub_be_to_cpu16 (data->superblock.uuid[6]), - grub_be_to_cpu16 (data->superblock.uuid[7])); + unsigned i; + for (i = 0; i < ARRAY_SIZE (data->superblock.uuid); i++) + if (data->superblock.uuid[i]) + break; + if (i < ARRAY_SIZE (data->superblock.uuid)) + *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + grub_be_to_cpu16 (data->superblock.uuid[0]), + grub_be_to_cpu16 (data->superblock.uuid[1]), + grub_be_to_cpu16 (data->superblock.uuid[2]), + grub_be_to_cpu16 (data->superblock.uuid[3]), + grub_be_to_cpu16 (data->superblock.uuid[4]), + grub_be_to_cpu16 (data->superblock.uuid[5]), + grub_be_to_cpu16 (data->superblock.uuid[6]), + grub_be_to_cpu16 (data->superblock.uuid[7])); } - else - *uuid = NULL; grub_dl_unref (my_mod);