summaryrefslogtreecommitdiff
path: root/fs/partitions/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/efi.c')
-rw-r--r--fs/partitions/efi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 80eeff5fdfe0..49cfd5f54238 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -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;