The branch main has been updated by des:

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

commit f9ff1e48cc1b77f1840fd514050ccc5904a0cac2
Author:     Dag-Erling Smørgrav <d...@freebsd.org>
AuthorDate: 2025-08-17 17:08:56 +0000
Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
CommitDate: 2025-08-17 17:29:28 +0000

    vfs: Assert that st_rdev is NODEV for non-devices
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D51956
---
 sys/kern/vfs_syscalls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index bf3ed9d515dc..aeb5657452dc 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2571,6 +2571,8 @@ kern_statat(struct thread *td, int flag, int fd, const 
char *path,
        }
        error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED);
        NDFREE_PNBUF(&nd);
+       KASSERT(error != 0 || VN_ISDEV(nd.ni_vp) || sbp->st_rdev == NODEV,
+           ("st_rdev should be NODEV unless the file is a device node"));
        vput(nd.ni_vp);
 #ifdef __STAT_TIME_T_EXT
        sbp->st_atim_ext = 0;

Reply via email to