git: 8ebacb9daa9e - main - nvmf_tcp: Correct calculation of number of TTAGs to allocate

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 30 Jul 2024 14:29:21 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ebacb9daa9ee3f3b6beed56477024009b84edc1

commit 8ebacb9daa9ee3f3b6beed56477024009b84edc1
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-30 14:28:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-07-30 14:28:54 +0000

    nvmf_tcp: Correct calculation of number of TTAGs to allocate
    
    The increment of 1 was intended to convert qp->maxr2t from 0's based
    to 1 based before multiplying by the queue length.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 135c9968d8eb..67d239b63faf 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1464,7 +1464,7 @@ tcp_allocate_qpair(bool controller,
 
 		/* NB: maxr2t is 0's based. */
 		qp->num_ttags = MIN((u_int)UINT16_MAX + 1,
-		    (uint64_t)params->qsize * (uint64_t)qp->maxr2t + 1);
+		    (uint64_t)params->qsize * ((uint64_t)qp->maxr2t + 1));
 		qp->open_ttags = mallocarray(qp->num_ttags,
 		    sizeof(*qp->open_ttags), M_NVMF_TCP, M_WAITOK | M_ZERO);
 	}