2022-07-25 19:40:57

by Max Filippov

[permalink] [raw]
Subject: [PATCH] drivers/nvme: fix pr_warn format string

Use %zu format instead of %lu to print variable of size_t type.
This fixes the following gcc build error on 32-bit targets:

error: format '%lu' expects argument of type 'long unsigned int',
but argument 3 has type 'size_t' {aka 'unsigned int'}

Fixes: 71ebe3842ebe ("nvmet-auth: Diffie-Hellman key exchange support")
Signed-off-by: Max Filippov <[email protected]>
---
drivers/nvme/target/auth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index bf92435c783c..716a10ca91d1 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -488,7 +488,7 @@ int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
return -ENOKEY;
}
if (buf_size != ctrl->dh_keysize) {
- pr_warn("ctrl %d DH public key size mismatch, need %lu is %d\n",
+ pr_warn("ctrl %d DH public key size mismatch, need %zu is %d\n",
ctrl->cntlid, ctrl->dh_keysize, buf_size);
ret = -EINVAL;
} else {
--
2.30.2


2022-07-26 11:52:24

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] drivers/nvme: fix pr_warn format string

This was already fixed by:

commit d6f7cd209b089553ce0217eb0091f5f5fdc654ba
Author: Christoph Hellwig <[email protected]>
Date: Mon Jul 18 07:02:29 2022 +0200

nvmet: fix a format specifier in nvmet_auth_ctrl_exponential