Ho ho ho, copystr(9) is a very old and seldom used kernel function, which performs a bounded string copy and optionally returns the length of the copied string.
In other words, copystr(src, dst, dstsiz, len) is equivalent to: if (strlcpy(dst, src, dstsiz) >= dstsiz) return ENAMETOOLONG; if (len != NULL) *len = strlen(dst); return 0; since, unlike all the other copy*(9) functions, this one doesn't have to check for faults since it copies from (supposedly) valid kernel memory to (supposedly) valid kernel memory. But strlcpy() didn't exist at the time copystr() was introduced. Now, there are three uses of copystr() left in the kernel, and two of them ignore the return value of copystr(), and do not need the length of the result to be returned. These two can be trivially replaced with strlcpy() calls. How about this diff? Miod Index: sys/kern/vfs_subr.c =================================================================== RCS file: /OpenBSD/src/sys/kern/vfs_subr.c,v retrieving revision 1.317 diff -u -p -u -p -r1.317 vfs_subr.c --- sys/kern/vfs_subr.c 14 Aug 2022 01:58:28 -0000 1.317 +++ sys/kern/vfs_subr.c 25 Dec 2022 16:57:42 -0000 @@ -270,8 +270,8 @@ vfs_rootmountalloc(char *fstypename, cha mp = vfs_mount_alloc(NULLVP, vfsp); mp->mnt_flag |= MNT_RDONLY; mp->mnt_stat.f_mntonname[0] = '/'; - copystr(devname, mp->mnt_stat.f_mntfromname, MNAMELEN, NULL); - copystr(devname, mp->mnt_stat.f_mntfromspec, MNAMELEN, NULL); + strlcpy(mp->mnt_stat.f_mntfromname, devname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromspec, devname, MNAMELEN); *mpp = mp; return (0); }