From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/4] efi: loader: fix EFI_EXIT2 tracing an uninitialized status
Date: Mon, 31 Aug 2026 15:24:52 +0200 [thread overview]
Message-ID: <20260831132456.730833-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260831132456.730833-1-a.fatoum@pengutronix.de>
EFI_EXIT2() stores its argument in _r and passes that to EFI_EXIT(),
whose own _r shadows it, so typeof(_r) _r = _r reads the uninitialized
inner variable and the traced status is garbage.
This only affects trace output was and was detected by a warning when
being compiled with clang.
Fixes: c05e8108d769 ("efi: loader: add support for tracing calls back into UEFI")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/efi/loader/trace.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/efi/loader/trace.h b/include/efi/loader/trace.h
index 4acf7c1634cc..767812f84e26 100644
--- a/include/efi/loader/trace.h
+++ b/include/efi/loader/trace.h
@@ -34,24 +34,25 @@ const char *__efi_nesting_dec(void);
*/
#ifndef EFI_EXIT
#define EFI_EXIT(ret) ({ \
- typeof(ret) _r = ret; \
+ typeof(ret) __efi_r = ret; \
__EFI_PRINT("%sEFI: Exit: %s: %s (%u)\n", __efi_nesting_dec(), \
- __func__, efi_strerror((uintptr_t)_r), (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \
- _r; \
+ __func__, efi_strerror((uintptr_t)__efi_r), \
+ (u32)((uintptr_t) __efi_r & ~EFI_ERROR_MASK)); \
+ __efi_r; \
})
#endif
#ifndef EFI_EXIT2
#define EFI_EXIT2(ret, val) ({ \
- typeof(ret) _r = ret; \
- if (EFI_ERROR(_r)) \
- EFI_EXIT(_r); \
+ typeof(ret) __efi_r2 = ret; \
+ if (EFI_ERROR(__efi_r2)) \
+ EFI_EXIT(__efi_r2); \
else \
__EFI_PRINT("%sEFI: Exit: %s: %s (%u) = 0x%llx\n", __efi_nesting_dec(), \
- __func__, efi_strerror((uintptr_t)_r), \
- (u32)((uintptr_t) _r & ~EFI_ERROR_MASK), \
+ __func__, efi_strerror((uintptr_t)__efi_r2), \
+ (u32)((uintptr_t) __efi_r2 & ~EFI_ERROR_MASK), \
(u64)(uintptr_t)(val)); \
- _r; \
+ __efi_r2; \
})
#endif
--
2.47.3
next prev parent reply other threads:[~2026-08-31 13:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 13:24 [PATCH master 1/4] common: boards: qemu: read the command line from the cmdline fw_cfg key Ahmad Fatoum
2026-08-31 13:24 ` Ahmad Fatoum [this message]
2026-08-31 13:24 ` [PATCH master 3/4] fs: efivarfs: initialize dummy data written on variable creation Ahmad Fatoum
2026-08-31 13:24 ` [PATCH master 4/4] sandbox: actually build the assembly setjmp/longjmp/initjmp Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831132456.730833-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox