git: 4dc196233e40 - main - bhyve: Fix assignment of *niov2 in split_iov()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Aug 2026 19:03:25 UTC
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;