Message ID | 1397639841-13771-1-git-send-email-ivan.hu@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 16/04/14 10:17, Ivan Hu wrote: > 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@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; > Thanks Ivan for spotting that. Acked-by: Colin Ian King <colin.king@canonical.com>
On 04/16/2014 05:17 PM, Ivan Hu wrote: > 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@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; > Acked-by: Alex Hung <alex.hung@canonical.com>
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;
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@canonical.com> --- src/lib/include/fwts_uefi.h | 4 ++-- src/uefi/uefidump/uefidump.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)