aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/efi.c')
-rw-r--r--fs/partitions/efi.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 63730282ad81..1bea610078b3 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -238,10 +238,9 @@ alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
238 le32_to_cpu(gpt->sizeof_partition_entry); 238 le32_to_cpu(gpt->sizeof_partition_entry);
239 if (!count) 239 if (!count)
240 return NULL; 240 return NULL;
241 pte = kmalloc(count, GFP_KERNEL); 241 pte = kzalloc(count, GFP_KERNEL);
242 if (!pte) 242 if (!pte)
243 return NULL; 243 return NULL;
244 memset(pte, 0, count);
245 244
246 if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba), 245 if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba),
247 (u8 *) pte, 246 (u8 *) pte,
@@ -269,10 +268,9 @@ alloc_read_gpt_header(struct block_device *bdev, u64 lba)
269 if (!bdev) 268 if (!bdev)
270 return NULL; 269 return NULL;
271 270
272 gpt = kmalloc(sizeof (gpt_header), GFP_KERNEL); 271 gpt = kzalloc(sizeof (gpt_header), GFP_KERNEL);
273 if (!gpt) 272 if (!gpt)
274 return NULL; 273 return NULL;
275 memset(gpt, 0, sizeof (gpt_header));
276 274
277 if (read_lba(bdev, lba, (u8 *) gpt, 275 if (read_lba(bdev, lba, (u8 *) gpt,
278 sizeof (gpt_header)) < sizeof (gpt_header)) { 276 sizeof (gpt_header)) < sizeof (gpt_header)) {
@@ -526,9 +524,8 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
526 lastlba = last_lba(bdev); 524 lastlba = last_lba(bdev);
527 if (!force_gpt) { 525 if (!force_gpt) {
528 /* This will be added to the EFI Spec. per Intel after v1.02. */ 526 /* This will be added to the EFI Spec. per Intel after v1.02. */
529 legacymbr = kmalloc(sizeof (*legacymbr), GFP_KERNEL); 527 legacymbr = kzalloc(sizeof (*legacymbr), GFP_KERNEL);
530 if (legacymbr) { 528 if (legacymbr) {
531 memset(legacymbr, 0, sizeof (*legacymbr));
532 read_lba(bdev, 0, (u8 *) legacymbr, 529 read_lba(bdev, 0, (u8 *) legacymbr,
533 sizeof (*legacymbr)); 530 sizeof (*legacymbr));
534 good_pmbr = is_pmbr_valid(legacymbr, lastlba); 531 good_pmbr = is_pmbr_valid(legacymbr, lastlba);