mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] certs: Print correct error on pkcs7_parse_message() failure
@ 2026-10-25  2:58 Tang Bin
  2026-10-27  2:57 ` Ben Boeckel
  0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2026-10-25  2:58 UTC (permalink / raw)
  To: dhowells, lukas, ignat, herbert, davem
  Cc: keyrings, linux-crypto, linux-kernel

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@cmss.chinamobile.com>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-27  2:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25  2:58 [PATCH] certs: Print correct error on pkcs7_parse_message() failure Tang Bin
2026-10-27  2:57 ` Ben Boeckel

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®