[PATCH 9/9] lib: random: print get_crypto_bytes caller when no HWRNG is registered
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue May 27 13:13:59 PDT 2025
When stack protector is enabled without a HWRNG, warning or error
messages are printed, but it's not directly evident why.
Improve this by printing the caller of the function leading to message
like this:
ERROR: stackprot_randomize_guard: no HWRNG available!
Reported-by: Roland Hieber <r.hieber at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
lib/random.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/random.c b/lib/random.c
index 889d314e0fad..0fbcf87ac0d3 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -135,11 +135,11 @@ int get_crypto_bytes(void *buf, int len)
}
if (!IS_ENABLED(CONFIG_ALLOW_PRNG_FALLBACK)) {
- pr_err("no HWRNG available!\n");
+ pr_err("%ps: no HWRNG available!\n", (void *)_RET_IP_);
return err;
}
- pr_warn("falling back to Pseudo RNG source!\n");
+ pr_warn("%ps: falling back to Pseudo RNG source!\n", (void *)_RET_IP_);
get_noncrypto_bytes(buf, len);
--
2.39.5
More information about the barebox
mailing list