[PATCH master 04/39] efi: loader: fix pointer vs value comparison in free_efi_only
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Feb 16 00:44:04 PST 2026
The check 'nfreed >= 0' compares the pointer itself (which is always
true for valid pointers) instead of the pointed-to value. This causes
the freed counter to be incremented even after it has been set to -1
to indicate an error.
Fix by dereferencing the pointer: '*nfreed >= 0'.
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
efi/loader/memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/efi/loader/memory.c b/efi/loader/memory.c
index 6ed7f76714f9..e8dfd59ee8ca 100644
--- a/efi/loader/memory.c
+++ b/efi/loader/memory.c
@@ -275,7 +275,7 @@ static int free_efi_only(struct resource *res, void *data)
return false;
}
- if (nfreed >= 0)
+ if (*nfreed >= 0)
++*nfreed;
return true;
}
--
2.47.3
More information about the barebox
mailing list