* [PATCH] crypto: x509_loader: Use %pe to log error pointer
@ 2026-10-15 12:45 Muhammad Mahdi Amirpour
0 siblings, 0 replies; only message in thread
From: Muhammad Mahdi Amirpour @ 2026-10-15 12:45 UTC (permalink / raw)
To: David Howells, Lukas Wunner, Ignat Korchagin, Herbert Xu,
David S . Miller
Cc: keyrings, linux-crypto, linux-kernel, Muhammad Mahdi Amirpour
The error path in x509_load_certificate_list() prints an error pointer
with %ld and PTR_ERR(), which produces a raw errno value rather than
the kernel's symbolic error name.
Use %pe on the error pointer directly so the log reads:
Problem loading in-kernel X.509 certificate (EINVAL)
instead of:
Problem loading in-kernel X.509 certificate (-22)
The new form is easier to read and matches the convention used
elsewhere in the kernel. Reported by Coccinelle's
misc/ptr_err_to_pe.cocci semantic patch.
Signed-off-by: Muhammad Mahdi Amirpour <ampr.mhd@gmail.com>
---
crypto/asymmetric_keys/x509_loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/asymmetric_keys/x509_loader.c b/crypto/asymmetric_keys/x509_loader.c
index 0d516c77cc2..373b5106e10 100644
--- a/crypto/asymmetric_keys/x509_loader.c
+++ b/crypto/asymmetric_keys/x509_loader.c
@@ -39,8 +39,8 @@ int x509_load_certificate_list(const u8 cert_list[],
KEY_ALLOC_BUILT_IN |
KEY_ALLOC_BYPASS_RESTRICTION);
if (IS_ERR(key)) {
- pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
- PTR_ERR(key));
+ pr_err("Problem loading in-kernel X.509 certificate (%pe)\n",
+ key);
} else {
pr_notice("Loaded X.509 cert '%s'\n",
key_ref_to_ptr(key)->description);
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-15 12:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 12:45 [PATCH] crypto: x509_loader: Use %pe to log error pointer Muhammad Mahdi Amirpour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®