Module Name: src Committed By: maxv Date: Fri Nov 15 15:51:57 UTC 2019
Modified Files: src/sys/kern: vfs_subr.c Log Message: NULL-check the structure pointer, not the address of its first field. This is clearer and also appeases syzbot. Reported-by: syzbot+d27bc1be926b3641c...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.472 -r1.473 src/sys/kern/vfs_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.472 src/sys/kern/vfs_subr.c:1.473 --- src/sys/kern/vfs_subr.c:1.472 Sun Sep 22 22:59:39 2019 +++ src/sys/kern/vfs_subr.c Fri Nov 15 15:51:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.473 2019/11/15 15:51:57 maxv Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.473 2019/11/15 15:51:57 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -758,6 +758,7 @@ sched_sync(void *arg) { mount_iterator_t *iter; synclist_t *slp; + struct vnode_impl *vi; struct vnode *vp; struct mount *mp; time_t starttime; @@ -790,7 +791,8 @@ sched_sync(void *arg) if (syncer_delayno >= syncer_last) syncer_delayno = 0; - while ((vp = VIMPL_TO_VNODE(TAILQ_FIRST(slp))) != NULL) { + while ((vi = TAILQ_FIRST(slp)) != NULL) { + vp = VIMPL_TO_VNODE(vi); synced = lazy_sync_vnode(vp); /*