Skip to content

Commit a10faf5

Browse files
authored
FreeBSD: Use the new freeuio() helper to free dynamically allocated UIOs (#16300)
This freeuio() interface was introduced to FreeBSD recently. For now it simply calls free(), so this change has no effect. However, this may not always be true, and in CheriBSD this change is required. Signed-off-by: Mark Johnston <markj@FreeBSD.org> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brooks Davis <brooks.davis@sri.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
1 parent 156a641 commit a10faf5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

module/os/freebsd/spl/spl_uio.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
#include <sys/vnode.h>
4646
#include <sys/zfs_znode.h>
4747

48+
static void
49+
zfs_freeuio(struct uio *uio)
50+
{
51+
#if __FreeBSD_version > 1500013
52+
freeuio(uio);
53+
#else
54+
free(uio, M_IOV);
55+
#endif
56+
}
57+
4858
int
4959
zfs_uiomove(void *cp, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio)
5060
{
@@ -77,7 +87,7 @@ zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, size_t *cbytes)
7787
error = vn_io_fault_uiomove(p, n, uio_clone);
7888
*cbytes = zfs_uio_resid(uio) - uio_clone->uio_resid;
7989
if (uio_clone != &small_uio_clone)
80-
free(uio_clone, M_IOV);
90+
zfs_freeuio(uio_clone);
8191
return (error);
8292
}
8393

0 commit comments

Comments
 (0)