mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Since the size of GPT entry may differ from the sizeof(struct gpt_ent),
use the size from GPT header to iterate entries. Suggested by: marcel@ MFC after: 1 week
This commit is contained in:
parent
50318baaa9
commit
94be23b653
1 changed files with 4 additions and 4 deletions
|
|
@ -212,8 +212,8 @@ gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size,
|
|||
return (-1);
|
||||
}
|
||||
}
|
||||
ent = (struct gpt_ent *)tbl;
|
||||
for (i = 0; i < cnt; i++, ent++) {
|
||||
for (i = 0; i < cnt; i++) {
|
||||
ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz);
|
||||
uuid_letoh(&ent->ent_type);
|
||||
if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL))
|
||||
continue;
|
||||
|
|
@ -303,10 +303,10 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
|
|||
table->type = PTABLE_NONE;
|
||||
goto out;
|
||||
}
|
||||
ent = (struct gpt_ent *)tbl;
|
||||
size = MIN(hdr.hdr_entries * hdr.hdr_entsz,
|
||||
MAXTBLSZ * table->sectorsize);
|
||||
for (i = 0; i < size / hdr.hdr_entsz; i++, ent++) {
|
||||
for (i = 0; i < size / hdr.hdr_entsz; i++) {
|
||||
ent = (struct gpt_ent *)(tbl + i * hdr.hdr_entsz);
|
||||
if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL))
|
||||
continue;
|
||||
entry = malloc(sizeof(*entry));
|
||||
|
|
|
|||
Loading…
Reference in a new issue