certs: Print correct error on pkcs7_parse_message() failure
Subsystems (3)
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")
Signed-off-by Tang Bin <[email protected]>
--- crypto/asymmetric_keys/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/asymmetric_keys/selftest.c +1 -1
@@ -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
Quoted 8 lines · Tang Bin
The panic on
IS_ERR(pkcs7)printed 'ret', which still holds the result of the prior successfulx509_load_certificate_list()(0) rather than the pkcs7 parse error. UsePTR_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 <[email protected]>
Already submitted:
https://www.spinics.net/lists/keyrings/msg19526.html
--Ben