[PATCH] nvme-auth: Avoid C=1 warning in nvme_auth_derive_tls_psk()

Hannes Reinecke hare at suse.de
Wed Jul 1 04:04:23 PDT 2026


On 6/25/26 7:59 PM, Eric Biggers wrote:
> The following works fine with gcc and clang, but sparse warns about
> label_len not being an actual constant expression:
> 
>      const size_t label_len = sizeof(label) - 1;
>      ...
>      static_assert(label_len <= 255);
> 
> Avoid this by giving label an explicit length and using sizeof(label)
> instead of label_len.
> 
> Reported-by: John Garry <john.g.garry at oracle.com>
> Closes: https://lore.kernel.org/linux-nvme/965a37dd-f698-46b6-9623-1099a13f7e60@oracle.com
> Fixes: d126cbaa7d9a ("nvme-auth: common: use crypto library in nvme_auth_derive_tls_psk()")
> Signed-off-by: Eric Biggers <ebiggers at kernel.org>
> ---
>   drivers/nvme/common/auth.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at kernel.org>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich



More information about the Linux-nvme mailing list