From df5026b47d2f90729b76071fd7cae48d46c4d1f6 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 8 Nov 2019 14:28:56 -0500 Subject: [PATCH] Fix minor errors in softpkcs11 Fix a printf type mismatch in attributes_match() reported by Coverity, and a possible uninitizlied use of key_type in add_certificate() reported by clang. [ghudson@mit.edu: squashed commits and rewrote commit message] (cherry picked from commit 560e48fee9a192ed4eb1b6cbd62c119087b53948) --- src/tests/softpkcs11/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tests/softpkcs11/main.c b/src/tests/softpkcs11/main.c index a4c3ae78e..1cccdfb43 100644 --- a/src/tests/softpkcs11/main.c +++ b/src/tests/softpkcs11/main.c @@ -261,7 +261,7 @@ attributes_match(const struct st_object *obj, } } if (match == 0) { - st_logf("type %d attribute have no match\n", attributes[i].type); + st_logf("type %lu attribute have no match\n", attributes[i].type); return 0; } } @@ -553,8 +553,9 @@ add_certificate(char *label, key_type = CKK_DSA; break; default: - /* XXX */ - break; + st_logf("invalid key_type\n"); + ret = CKR_GENERAL_ERROR; + goto out; } c = CKO_CERTIFICATE;