efi_var_to_file() reports the reason it could not write the variable file
with %pe, but the one error it synthesizes itself is stored with the
wrong sign. ERR_PTR(ENOMEM) is not an error pointer, so IS_ERR() is false
and %pe prints the bogus pointer 0xc instead of "No memory".

The three other assignments to err already store negative errnos.

Assisted-by: Claude:opus-5
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 efi/loader/efi_var_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/loader/efi_var_file.c b/efi/loader/efi_var_file.c
index fbafd901bd0c..e4d350002ee8 100644
--- a/efi/loader/efi_var_file.c
+++ b/efi/loader/efi_var_file.c
@@ -52,7 +52,7 @@ efi_status_t efi_var_to_file(void)
 
        efiret = efi_var_collect(&buf, &len, EFI_VARIABLE_NON_VOLATILE);
        if (efiret != EFI_SUCCESS) {
-               err = ENOMEM;
+               err = -ENOMEM;
                goto error;
        }
 
-- 
2.47.3


Reply via email to