[PATCH] nvmet: use appropriate types for authentication payload lengths
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sat Oct 31 01:09:17 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] nvmet: format specifier mismatch in nvmet_auth_challenge()
--
commit 53d4c9b2a209bbb82f1d82e67292975434b27d23
Author: Sreeraj S Kurup <sreekuttan2156239 at gmail.com>
nvmet: use appropriate types for authentication payload lengths
This commit changes the payload length parameter al in nvmet_auth_challenge()
and nvmet_auth_success1() from int to u32, and changes data_size in
nvmet_auth_challenge() from int to size_t.
> diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c
> index 70136f6c22e8c..99caad6fb87fb 100644
> --- a/drivers/nvme/target/fabrics-cmd-auth.c
> +++ b/drivers/nvme/target/fabrics-cmd-auth.c
> @@ -448,13 +448,13 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
> nvmet_req_complete(req, status);
> }
>
> -static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al)
> +static int nvmet_auth_challenge(struct nvmet_req *req, void *d, u32 al)
> {
> struct nvmf_auth_dhchap_challenge_data *data = d;
> struct nvmet_ctrl *ctrl = req->sq->ctrl;
> int ret = 0;
> int hash_len = nvme_auth_hmac_hash_len(ctrl->shash_id);
> - int data_size = sizeof(*data) + hash_len;
> + size_t data_size = sizeof(*data) + hash_len;
>
> if (ctrl->dh_tfm)
> data_size += ctrl->dh_keysize;
[Severity: Low]
Now that al is u32 and data_size is size_t in nvmet_auth_challenge(), does the
pr_debug() immediately below also need its format specifiers updated from %d
to %u and %zu to avoid a -Wformat warning on 64-bit builds?
if (al < data_size) {
pr_debug("%s: buffer too small (al %d need %d)\n", __func__,
al, data_size);
return -EINVAL;
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261031075932.4345-1-sreekuttan2156239@gmail.com?part=1
More information about the Linux-nvme
mailing list