[PATCH] nvme-tcp: fix signedness bug in nvme_tcp_init_connection()

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Mar 3 10:43:07 PST 2025


On 2/28/25 01:39, Dan Carpenter wrote:
> The kernel_recvmsg() function returns an int which could be either
> negative error codes or the number of bytes received.  The problem is
> that the condition:
>
> 	if (ret < sizeof(*icresp)) {
>
> is type promoted to type unsigned long and negative values are treated
> as high positive values which is success, when they should be treated as
> failure.  Add a cast so to avoid the type promotion.
>
> Fixes: 578539e09690 ("nvme-tcp: fix connect failure on receiving partial ICResp PDU")
> Signed-off-by: Dan Carpenter<dan.carpenter at linaro.org>

Thanks for the fix, looks good.

Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>

-ck




More information about the Linux-nvme mailing list