From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id E5D7E5A026F; Tue, 11 Feb 2025 20:51:33 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] tcp_vu: Fix off-by one in header count array adjustment Date: Tue, 11 Feb 2025 20:51:33 +0100 Message-ID: <20250211195133.198082-1-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 7CAUJKHOYPUQCTFRRRU4PBG6QDFTJJNP X-Message-ID-Hash: 7CAUJKHOYPUQCTFRRRU4PBG6QDFTJJNP X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson , Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laurent Vivier Not entirely clear to me why, but Laurent proposed this patch to fix an issue were we would end up with a zero buf_cnt in tcp_vu_data_from_sock() and all sorts of weirdnesses. Reported-by: David Gibson [sbrivio: commit message, albeit not really descriptive] Signed-off-by: Stefano Brivio --- tcp_vu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp_vu.c b/tcp_vu.c index fad7065..0622f17 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -261,7 +261,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx *c, len -= iov->iov_len; } /* adjust head count */ - while (head_cnt > 0 && head[head_cnt - 1] > i) + while (head_cnt > 0 && head[head_cnt - 1] >= i) head_cnt--; /* mark end of array */ head[head_cnt] = i; -- 2.43.0