When we have 4kB sectors instead of 512b sectors, hd.partition_start and grub_partition_get_start() won't match - the latter assumes 512-byte sectors, and the former gives us the correct number based on the physical media's sector size. So when we have to compare them, we need to compensate.
Signed-off-by: Peter Jones <pjo...@redhat.com> --- grub-core/disk/efi/efidisk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 77ab5b0..a905b52 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -791,11 +791,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) auto int find_partition (grub_disk_t disk, const grub_partition_t part); /* Find the identical partition. */ - int find_partition (grub_disk_t disk __attribute__ ((unused)), - const grub_partition_t part) + int find_partition (grub_disk_t disk, const grub_partition_t part) { - if (grub_partition_get_start (part) == hd.partition_start - && grub_partition_get_len (part) == hd.partition_size) + struct grub_efidisk_data *d = disk->data; + grub_efi_block_io_media_t *m = d->block_io->media; + + if (grub_partition_get_start (part) / (m->block_size / 512) == hd.partition_start + && grub_partition_get_len (part) / (m->block_size / 512) == hd.partition_size) { partition_name = grub_partition_get_name (part); return 1; -- 1.8.1.4 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel