git: 34ca5a9e7362 - main - geom_zero(4): reset the uio vector on each uiomove()

Konstantin Belousov <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=34ca5a9e7362b0c820fe339daa2b8d06c58b6fea

commit 34ca5a9e7362b0c820fe339daa2b8d06c58b6fea
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-07-26 21:45:07 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-07-27 18:46:32 +0000

    geom_zero(4): reset the uio vector on each uiomove()
    
    PR:     297062
    Tested by:      Jordan Gordeev <[email protected]>
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D58472
---
 sys/geom/zero/g_zero.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/geom/zero/g_zero.c b/sys/geom/zero/g_zero.c
index 25d462a9f918..e02fffbd6f02 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.