Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Aug 2026 19:03:25 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4dc196233e40 - main - bhyve: Fix assignment of *niov2 in split_iov()
Message-ID:  <6a7388fd.37b96.52eebdc1@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4dc196233e406cd30b9b1936adb91381f6892a6a

commit 4dc196233e406cd30b9b1936adb91381f6892a6a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-08-05 18:58:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-05 18:58:32 +0000

    bhyve: Fix assignment of *niov2 in split_iov()
    
    niov2 returns the number of entries in the iovec starting at offset
    "offset".  Here we are unconditionally setting it to 1, which of course
    isn't right.
    
    Fixes:          a28cf86c4171 ("bhyve/virtio: Rework iovec handling functions for efficiency and clarity")
    Reported by:    Claude and Ada Logics
    Reviewed by:    Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58625
---
 usr.sbin/bhyve/iov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/iov.c b/usr.sbin/bhyve/iov.c
index aadea1d67933..637b1f4be304 100644
--- a/usr.sbin/bhyve/iov.c
+++ b/usr.sbin/bhyve/iov.c
@@ -71,8 +71,8 @@ split_iov(struct iovec *iov, size_t *niov1, size_t offset, size_t *niov2)
 	}
 
 	/* The entry iov[count] needs to be split. */
-	*niov1 = count + 1;
 	*niov2 = *niov1 - count;
+	*niov1 = count + 1;
 	memmove(&iov[count + 1], &iov[count], sizeof(struct iovec) * (*niov2));
 	iov[count].iov_len = resid;
 	iov[count + 1].iov_base = (char *)iov[count].iov_base + resid;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a7388fd.37b96.52eebdc1>