aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-07-26 21:45:07 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-08-03 00:23:17 +0000
commit0aa72376d73bef2612f308a6de8b33e9584894de (patch)
treea7ccd554a11a124597cf124500e6ffc2210f7b98
parent7d243813ca639d464b3c7baa1953bc41f89031f9 (diff)
geom_zero(4): reset the uio vector on each uiomove()
PR: 297062 (cherry picked from commit 34ca5a9e7362b0c820fe339daa2b8d06c58b6fea)
-rw-r--r--sys/geom/zero/g_zero.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/geom/zero/g_zero.c b/sys/geom/zero/g_zero.c
index 325e12633a31..8244df77b257 100644
--- a/sys/geom/zero/g_zero.c
+++ b/sys/geom/zero/g_zero.c
@@ -83,11 +83,6 @@ g_zero_fill_pages(struct bio *bp)
size_t length;
vm_offset_t offset;
- aiovec.iov_base = g_zero_buffer;
- aiovec.iov_len = PAGE_SIZE;
- auio.uio_iov = &aiovec;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_WRITE;
auio.uio_td = curthread;
@@ -101,6 +96,12 @@ g_zero_fill_pages(struct bio *bp)
bp->bio_resid = bp->bio_length;
offset = bp->bio_ma_offset & PAGE_MASK;
for (int i = 0; i < bp->bio_ma_n && bp->bio_resid > 0; i++) {
+ aiovec.iov_base = g_zero_buffer;
+ aiovec.iov_len = PAGE_SIZE;
+ auio.uio_iov = &aiovec;
+ auio.uio_iovcnt = 1;
+ auio.uio_offset = 0;
+
length = MIN(PAGE_SIZE - offset, bp->bio_resid);
auio.uio_resid = length;