Re: [PATCH v2] nvmet: use appropriate types for authentication payload lengths

From: Keith Busch

Date: Tue Nov 03 2026 - 13:05:23 EST


On Sat, Oct 31, 2026 at 08:17:51AM +0000, Sreeraj S Kurup wrote:
> The authentication payload length is obtained as a u32 value from the
> NVMe command, but nvmet_auth_challenge() and nvmet_auth_success1()
> accept it as a signed int.
>
> Use u32 for the payload length parameters in both functions to keep
> their types consistent with the value returned by
> nvmet_auth_receive_data_len() and avoid an unnecessary conversion
> from unsigned to signed.
>
> Also, use size_t for data_size in nvmet_auth_challenge(), since the
> calculation includes sizeof(), which returns size_t. This avoids
> implicitly narrowing the calculated payload size to int.
>
> These changes make the payload length handling consistent with the
> underlying types and avoid potential signedness and narrowing issues.

Thanks, applied to nvme-7.4.