From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 225D55A061C; Wed, 27 Nov 2024 15:43:27 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] tcp_vu: Change 'dlen' to ssize_t in tcp_vu_data_from_sock() Date: Wed, 27 Nov 2024 15:43:27 +0100 Message-ID: <20241127144327.3778810-1-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: HNEIWX5IR5XFSCK4GYBLNI7YEAPRU7MH X-Message-ID-Hash: HNEIWX5IR5XFSCK4GYBLNI7YEAPRU7MH 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: 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: ...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 --- This applies on top of "[PATCH] Fix build on 32bit target" tcp_vu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp_vu.c b/tcp_vu.c index 05e2d1d..a1510d9 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -462,7 +462,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); -- 2.43.0