git: 13d3bd165e22 - main - subr_uio.c: Remove a KASSERT() for large NFS server I/O

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 14 May 2026 22:19:35 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=13d3bd165e225eec9af91b6e3361c2482931f95b

commit 13d3bd165e225eec9af91b6e3361c2482931f95b
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-05-14 22:17:55 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-05-14 22:17:55 +0000

    subr_uio.c: Remove a KASSERT() for large NFS server I/O
    
    When the NFS server is set to allow an I/O size greater
    than 1Mbyte (not allowed in FreeBSD's main yet), a
    KASSERT() in allocuio() can fail when:
    zfs_freebsd_write()->zfs_write()->zfs_uiocopy()
    ->cloneuio()->allocuio()
    is called for a large NFS server write.
    
    Since the userland API callers to allocuio() already
    check that the size does not exceed UIO_MAXIOV,
    there does not seem to be a need to a KASSERT()
    here.
    
    Removing the KASSERT() allows NFS server writes
    of greater than 1Mbyte to work, once the NFS code
    is patched to allow them.
    
    Reviewed by:    kib
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D57005
---
 sys/kern/subr_uio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
index 6ac932fb6690..fa5865fbe938 100644
--- a/sys/kern/subr_uio.c
+++ b/sys/kern/subr_uio.c
@@ -441,8 +441,6 @@ allocuio(u_int iovcnt)
 	struct uio *uio;
 	int iovlen;
 
-	KASSERT(iovcnt <= UIO_MAXIOV,
-	    ("Requested %u iovecs exceed UIO_MAXIOV", iovcnt));
 	iovlen = iovcnt * sizeof(struct iovec);
 	uio = malloc(iovlen + sizeof(*uio), M_IOV, M_WAITOK);
 	uio->uio_iov = (struct iovec *)(uio + 1);