summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/boot/common/part.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c
index d0ee938..086809f 100644
--- a/sys/boot/common/part.c
+++ b/sys/boot/common/part.c
@@ -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));
OpenPOWER on IntegriCloud