[PATCH] certs: Print correct error on pkcs7_parse_message() failure

From: Tang Bin

Date: Sat Oct 24 2026 - 22:59:00 EST


The panic on IS_ERR(pkcs7) printed 'ret', which still holds the result of
the prior successful x509_load_certificate_list() (0) rather than the pkcs7
parse error. Use PTR_ERR(pkcs7) and %ld so the real failure code is
reported.

Fixes: 8cd9f234f706 ("certs: Move RSA self-test data to separate file")

Signed-off-by: Tang Bin <tangbin@xxxxxxxxxxxxxxxxxxxx>
---
crypto/asymmetric_keys/selftest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/asymmetric_keys/selftest.c b/crypto/asymmetric_keys/selftest.c
index 98dc5cdfd..179b385cc 100644
--- a/crypto/asymmetric_keys/selftest.c
+++ b/crypto/asymmetric_keys/selftest.c
@@ -41,7 +41,7 @@ void fips_signature_selftest(const char *name,

pkcs7 = pkcs7_parse_message(sig, sig_len);
if (IS_ERR(pkcs7))
- panic("Certs %s selftest: pkcs7_parse_message() = %d\n", name, ret);
+ panic("Certs %s selftest: pkcs7_parse_message() = %ld\n", name, PTR_ERR(pkcs7));

pkcs7_supply_detached_data(pkcs7, data, data_len);

--
2.52.0.windows.1