Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172960
b: refs/heads/master
c: 87038c2
h: refs/heads/master
v: v3
  • Loading branch information
Karel Zak authored and Jens Axboe committed Nov 23, 2009
1 parent 6685012 commit 9d37c77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d13af3279985f554784a45cc961f706dbcdbdd1
refs/heads/master: 87038c2d5bda2418fda8b1456a0ae81cc3ff5bd8
7 changes: 4 additions & 3 deletions trunk/fs/partitions/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,16 @@ static gpt_header *
alloc_read_gpt_header(struct block_device *bdev, u64 lba)
{
gpt_header *gpt;
unsigned ssz = bdev_logical_block_size(bdev);

if (!bdev)
return NULL;

gpt = kzalloc(sizeof (gpt_header), GFP_KERNEL);
gpt = kzalloc(ssz, GFP_KERNEL);
if (!gpt)
return NULL;

if (read_lba(bdev, lba, (u8 *) gpt,
sizeof (gpt_header)) < sizeof (gpt_header)) {
if (read_lba(bdev, lba, (u8 *) gpt, ssz) < ssz) {
kfree(gpt);
gpt=NULL;
return NULL;
Expand Down
8 changes: 6 additions & 2 deletions trunk/fs/partitions/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define EFI_PMBR_OSTYPE_EFI 0xEF
#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE

#define GPT_BLOCK_SIZE 512
#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
#define GPT_HEADER_REVISION_V1 0x00010000
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
Expand Down Expand Up @@ -79,7 +78,12 @@ typedef struct _gpt_header {
__le32 num_partition_entries;
__le32 sizeof_partition_entry;
__le32 partition_entry_array_crc32;
u8 reserved2[GPT_BLOCK_SIZE - 92];

/* The rest of the logical block is reserved by UEFI and must be zero.
* EFI standard handles this by:
*
* uint8_t reserved2[ BlockSize - 92 ];
*/
} __attribute__ ((packed)) gpt_header;

typedef struct _gpt_entry_attributes {
Expand Down

0 comments on commit 9d37c77

Please sign in to comment.