From d0cba600e7c925c5254a454b1c3868410aed429b Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Wed, 9 Feb 2022 07:02:08 -0800 Subject: [PATCH] bootinfo: fix error path for no bootinfo block 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 --- bootinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootinfo.c b/bootinfo.c index 3f11489..372dc16 100644 --- a/bootinfo.c +++ b/bootinfo.c @@ -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]);