NULL-check the structure pointer, not the address of its first field. This

is clearer and also appeases syzbot.

Reported-by: syzbot+d27bc1be926b3641c0ad@syzkaller.appspotmail.com
This commit is contained in:
maxv 2019-11-15 15:51:57 +00:00
parent 73fee7f7e5
commit 473e202ba1
1 changed files with 5 additions and 3 deletions

View File

@ -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);
/*