From 804a7ce94a14fbc4dee0a14b2c5f7a72ebb8bff6 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 27 Nov 2024 15:37:01 +0100 Subject: tcp_vu: Change 'dlen' to ssize_t in tcp_vu_data_from_sock() ...to quickly suppress a false positive from Coverity, which assumes that iov_size is 0 and 'dlen' might overflow as a result (with hdrlen being 66). An ASSERT() in tcp_vu_sock_recv() already guarantees that iov_size(iov, buf_cnt) here is anyway greater than 'hdrlen'. Signed-off-by: Stefano Brivio Reviewed-by: Laurent Vivier --- tcp_vu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp_vu.c b/tcp_vu.c index f27e175..bbae918 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -463,7 +463,7 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) for (i = 0, check = NULL; i < head_cnt; i++) { struct iovec *iov = &elem[head[i]].in_sg[0]; int buf_cnt = head[i + 1] - head[i]; - int dlen = iov_size(iov, buf_cnt) - hdrlen; + ssize_t dlen = iov_size(iov, buf_cnt) - hdrlen; vu_set_vnethdr(vdev, iov->iov_base, buf_cnt); -- cgit v1.2.3