Skip to contentSkip to conversation

certs: Print correct error on pkcs7_parse_message() failure

PATCH In review Tang Bin 2 participants 2 messages Oct 25 – Oct 27

Subsystems (3)
lore
Share & tools
lore

Tang Bin

author
#0 lore raw

PATCH 1/1 certs: Print correct error on pkcs7_parse_message() failure

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")
---
 crypto/asymmetric_keys/selftest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/asymmetric_keys/selftest.c +1 -1
index 98dc5cdfd..179b385cc 100644
@@ -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);
 
Signature · 1 line
2.52.0.windows.1