Skip to content

Commit

Permalink
cmd: fix gpt setenv
Browse files Browse the repository at this point in the history
Do not assume that partitions are continuously numbered starting at 1.

Having a partition table with a single partition 63 is valid.

Fixes: 12fc1f3 ("cmd: gpt: add eMMC and GPT support")
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
xypron committed Aug 27, 2023
1 parent eb48efc commit 0183467
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cmd/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,8 @@ static int gpt_setenv(struct blk_desc *desc, const char *name)

for (i = 1; i < part_drv->max_entries; i++) {
ret = part_drv->get_info(desc, i, &pinfo);
if (ret) {
/* no more entries in table */
break;
}
if (ret)
continue;

if (!strcmp(name, (const char *)pinfo.name)) {
/* match found, setup environment variables */
Expand Down

0 comments on commit 0183467

Please sign in to comment.