limine-install/gpt: Fix broken comparison of partition count and print out partition count when embedding

This commit is contained in:
mintsuki 2020-12-26 20:38:30 +01:00
parent 34ddbe6f14
commit 9bff739de1

View File

@ -236,11 +236,13 @@ int main(int argc, char *argv[]) {
size_t new_partition_entry_count = size_t new_partition_entry_count =
new_partition_array_lba_size * partition_entries_per_lb; new_partition_array_lba_size * partition_entries_per_lb;
if ((ssize_t)new_partition_array_lba_size <= max_partition_entry_used) { if ((ssize_t)new_partition_entry_count <= max_partition_entry_used) {
fprintf(stderr, "error: Cannot embed because there are too many used partition entries.\n"); fprintf(stderr, "error: Cannot embed because there are too many used partition entries.\n");
goto cleanup; goto cleanup;
} }
fprintf(stderr, "New maximum count of partition entries: %zu.\n", new_partition_entry_count);
uint8_t *partition_array = uint8_t *partition_array =
malloc(new_partition_entry_count * gpt_header.size_of_partition_entry); malloc(new_partition_entry_count * gpt_header.size_of_partition_entry);
if (partition_array == NULL) { if (partition_array == NULL) {