Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern NULL-check the structure pointer, not the address o...



details:   https://anonhg.NetBSD.org/src/rev/8b6a6cd31053
branches:  trunk
changeset: 465289:8b6a6cd31053
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Nov 15 15:51:57 2019 +0000

description:
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@localhost

diffstat:

 sys/kern/vfs_subr.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 6866c1ff4422 -r 8b6a6cd31053 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Fri Nov 15 13:25:53 2019 +0000
+++ b/sys/kern/vfs_subr.c       Fri Nov 15 15:51:57 2019 +0000
@@ -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 @@
 {
        mount_iterator_t *iter;
        synclist_t *slp;
+       struct vnode_impl *vi;
        struct vnode *vp;
        struct mount *mp;
        time_t starttime;
@@ -790,7 +791,8 @@
                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);
 
                        /*



Home | Main Index | Thread Index | Old Index