Skip to content

Commit

Permalink
bootinfo: fix error path for no bootinfo block
Browse files Browse the repository at this point in the history
Set errno to ENODATA in bootinfo_open() when trying
to open bootinfo read-only and the block has not
been initialized.

Signed-off-by: Matt Madison <[email protected]>
  • Loading branch information
madisongh committed Feb 11, 2022
1 parent 068c543 commit d0cba60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bootinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,10 @@ bootinfo_open (unsigned int flags, struct bootinfo_context_s **ctxp)
if (boot_devinfo_init(ctx) < 0)
goto failure_exit;
/* If successful, fall through */
} else
} else {
errno = ENODATA;
goto failure_exit;
}
} else if (i < 2 && ctx->valid[1-i]) {
/* both of the first two are valid */
struct device_info *dp1 = (struct device_info *) (ctx->infobuf[1]);
Expand Down

0 comments on commit d0cba60

Please sign in to comment.