public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] Fix assert() in tcp_vu_sock_recv()
@ 2026-11-16 13:21 Laurent Vivier
  2026-11-17 11:04 ` Stefano Brivio
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2026-11-16 13:21 UTC (permalink / raw)
  To: passt-dev; +Cc: Johannes Bartunek, Jon Maloy, Laurent Vivier

In tcp_vu_sock_recv(), iov_tail_clone() can copy up to
ARRAY_SIZE(iov_msg) - j entries so the assert must allow
ARRAY_SIZE(iov_msg) - j as valid a value.

Reported-by: Johannes Bartunek <contact@jbartunek.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 tcp_vu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcp_vu.c b/tcp_vu.c
index 868a35b968e1..c83abd69d3d7 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -291,7 +291,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq,
 
 		cnt = iov_tail_clone(&iov_msg[j], ARRAY_SIZE(iov_msg) - j,
 				     &data);
-		assert(cnt < ARRAY_SIZE(iov_msg) - j);
+		assert(cnt <= ARRAY_SIZE(iov_msg) - j);
 		if (cnt < 0)
 			die("Missing entries in iov_msg");
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix assert() in tcp_vu_sock_recv()
  2026-11-16 13:21 [PATCH] Fix assert() in tcp_vu_sock_recv() Laurent Vivier
@ 2026-11-17 11:04 ` Stefano Brivio
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Brivio @ 2026-11-17 11:04 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: passt-dev, Johannes Bartunek, Jon Maloy

On Mon, 16 Nov 2026 14:21:19 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> In tcp_vu_sock_recv(), iov_tail_clone() can copy up to
> ARRAY_SIZE(iov_msg) - j entries so the assert must allow
> ARRAY_SIZE(iov_msg) - j as valid a value.
> 
> Reported-by: Johannes Bartunek <contact@jbartunek.de>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  tcp_vu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tcp_vu.c b/tcp_vu.c
> index 868a35b968e1..c83abd69d3d7 100644
> --- a/tcp_vu.c
> +++ b/tcp_vu.c
> @@ -291,7 +291,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq,
>  
>  		cnt = iov_tail_clone(&iov_msg[j], ARRAY_SIZE(iov_msg) - j,
>  				     &data);
> -		assert(cnt < ARRAY_SIZE(iov_msg) - j);
> +		assert(cnt <= ARRAY_SIZE(iov_msg) - j);
>  		if (cnt < 0)
>  			die("Missing entries in iov_msg");
>  

Applied.

-- 
Stefano


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-17 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 13:21 [PATCH] Fix assert() in tcp_vu_sock_recv() Laurent Vivier
2026-11-17 11:04 ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).