Lines Matching refs:gpt
274 gpt_header *gpt) in alloc_read_gpt_entries() argument
279 if (!gpt) in alloc_read_gpt_entries()
282 count = (size_t)le32_to_cpu(gpt->num_partition_entries) * in alloc_read_gpt_entries()
283 le32_to_cpu(gpt->sizeof_partition_entry); in alloc_read_gpt_entries()
290 if (read_lba(state, le64_to_cpu(gpt->partition_entry_lba), in alloc_read_gpt_entries()
311 gpt_header *gpt; in alloc_read_gpt_header() local
314 gpt = kmalloc(ssz, GFP_KERNEL); in alloc_read_gpt_header()
315 if (!gpt) in alloc_read_gpt_header()
318 if (read_lba(state, lba, (u8 *) gpt, ssz) < ssz) { in alloc_read_gpt_header()
319 kfree(gpt); in alloc_read_gpt_header()
320 gpt=NULL; in alloc_read_gpt_header()
324 return gpt; in alloc_read_gpt_header()
338 gpt_header **gpt, gpt_entry **ptes) in is_gpt_valid() argument
345 if (!(*gpt = alloc_read_gpt_header(state, lba))) in is_gpt_valid()
349 if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) { in is_gpt_valid()
352 (unsigned long long)le64_to_cpu((*gpt)->signature), in is_gpt_valid()
358 if (le32_to_cpu((*gpt)->header_size) > in is_gpt_valid()
361 le32_to_cpu((*gpt)->header_size), in is_gpt_valid()
367 if (le32_to_cpu((*gpt)->header_size) < sizeof(gpt_header)) { in is_gpt_valid()
369 le32_to_cpu((*gpt)->header_size), in is_gpt_valid()
375 origcrc = le32_to_cpu((*gpt)->header_crc32); in is_gpt_valid()
376 (*gpt)->header_crc32 = 0; in is_gpt_valid()
377 crc = efi_crc32((const unsigned char *) (*gpt), le32_to_cpu((*gpt)->header_size)); in is_gpt_valid()
384 (*gpt)->header_crc32 = cpu_to_le32(origcrc); in is_gpt_valid()
388 if (le64_to_cpu((*gpt)->my_lba) != lba) { in is_gpt_valid()
390 (unsigned long long)le64_to_cpu((*gpt)->my_lba), in is_gpt_valid()
399 if (le64_to_cpu((*gpt)->first_usable_lba) > lastlba) { in is_gpt_valid()
401 (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba), in is_gpt_valid()
405 if (le64_to_cpu((*gpt)->last_usable_lba) > lastlba) { in is_gpt_valid()
407 (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), in is_gpt_valid()
411 if (le64_to_cpu((*gpt)->last_usable_lba) < le64_to_cpu((*gpt)->first_usable_lba)) { in is_gpt_valid()
413 (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), in is_gpt_valid()
414 (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba)); in is_gpt_valid()
418 if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { in is_gpt_valid()
424 pt_size = (u64)le32_to_cpu((*gpt)->num_partition_entries) * in is_gpt_valid()
425 le32_to_cpu((*gpt)->sizeof_partition_entry); in is_gpt_valid()
432 if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) in is_gpt_valid()
438 if (crc != le32_to_cpu((*gpt)->partition_entry_array_crc32)) { in is_gpt_valid()
450 kfree(*gpt); in is_gpt_valid()
451 *gpt = NULL; in is_gpt_valid()
583 static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt, in find_valid_gpt() argument
632 *gpt = pgpt; in find_valid_gpt()
641 *gpt = agpt; in find_valid_gpt()
654 *gpt = NULL; in find_valid_gpt()
680 gpt_header *gpt = NULL; in efi_partition() local
685 if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { in efi_partition()
686 kfree(gpt); in efi_partition()
693 for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) { in efi_partition()
727 kfree(gpt); in efi_partition()