GPT entry LBA range is inclusive

This commit is contained in:
TuxSH 2018-05-17 14:38:19 +02:00
parent 85bfbeccc3
commit 858b40e5fb

View File

@ -163,7 +163,7 @@ static int switchfs_mount_partition_gpt_callback(const efi_entry_t *entry, void
for (size_t i = 0; i < sizeof(known_partitions)/sizeof(known_partitions[0]); i++) { for (size_t i = 0; i < sizeof(known_partitions)/sizeof(known_partitions[0]); i++) {
if (strcmp(name_buffer, known_partitions[i].partition_name) == 0) { if (strcmp(name_buffer, known_partitions[i].partition_name) == 0) {
devpart.start_sector += entry->first_lba; devpart.start_sector += entry->first_lba;
devpart.num_sectors = entry->last_lba - entry->first_lba; devpart.num_sectors = (entry->last_lba + 1) - entry->first_lba;
if (parent->num_sectors < devpart.num_sectors) { if (parent->num_sectors < devpart.num_sectors) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;