Skip to contentSkip to conversation

crypto: testmgr - Fix format argument warning

PATCH In review Ye Bin 2 participants 2 messages Oct 10, 2020

Subsystems (2)
lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH 1/1 crypto: testmgr - Fix format argument warning

Fix follow warning:
[crypto/testmgr.c:2317]: (warning) %d in format string (no. 5) requires 'int' but the argument type is 'unsigned int'.

---
 crypto/testmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/testmgr.c +1 -1
index a64a639eddfa..aefa4b6b8d78 100644
@@ -2315,7 +2315,7 @@ static void generate_random_aead_testvec(struct aead_request *req,
 	if (vec->setkey_error == 0 && vec->setauthsize_error == 0)
 		generate_aead_message(req, suite, vec, prefer_inauthentic);
 	snprintf(name, max_namelen,
-		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"",
+		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%u\"",
 		 vec->alen, vec->plen, authsize, vec->klen, vec->novrfy);
 }
 
Signature · 7 lines
2.16.2.dirty


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 15 lines · Ye Bin

Fix follow warning:
[crypto/testmgr.c:2317]: (warning) %d in format string (no. 5) requires 'int' but the argument type is 'unsigned int'.

---
 crypto/testmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/testmgr.c +0 -0
index a64a639eddfa..aefa4b6b8d78 100644

crypto/testmgr.c static void generate_random_aead_testvec(struct aead_request *req, · line 2319

Quoted 6 lines
crypto/testmgr.c +1 -1
@@ -2315,7 +2315,7 @@ static void generate_random_aead_testvec(struct aead_request *req,
 	if (vec->setkey_error == 0 && vec->setauthsize_error == 0)
 		generate_aead_message(req, suite, vec, prefer_inauthentic);
 	snprintf(name, max_namelen,
-		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"",
+		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%u\"",
 		 vec->alen, vec->plen, authsize, vec->klen, vec->novrfy);

Actually vec->novrfy is 'unsigned char', not 'unsigned int'. Both %u and %d will work, but %d is technically correct because 'unsigned char' gets promoted to 'int'. What tool are you using that claims this is wrong?

- Eric

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel