[PATCH] crypto: x509_loader: Use %pe to log error pointer

From: Muhammad Mahdi Amirpour

Date: Thu Oct 15 2026 - 09:16:04 EST


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@xxxxxxxxx>
---
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