Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add a NULL check on the structure (same logic as my...



details:   https://anonhg.NetBSD.org/src/rev/b932ecb00796
branches:  trunk
changeset: 461097:b932ecb00796
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Nov 16 10:05:44 2019 +0000

description:
Add a NULL check on the structure (same logic as my previous change in this
file). For clarity, and to appease kUBSan.

diffstat:

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

diffs (28 lines):

diff -r 1f8e5dd02797 -r b932ecb00796 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Sat Nov 16 09:22:00 2019 +0000
+++ b/sys/kern/vfs_subr.c       Sat Nov 16 10:05:44 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.473 2019/11/15 15:51:57 maxv Exp $      */
+/*     $NetBSD: vfs_subr.c,v 1.474 2019/11/16 10:05:44 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.473 2019/11/15 15:51:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.474 2019/11/16 10:05:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -799,7 +799,8 @@
                         * XXX The vnode may have been recycled, in which
                         * case it may have a new identity.
                         */
-                       if (VIMPL_TO_VNODE(TAILQ_FIRST(slp)) == vp) {
+                       vi = TAILQ_FIRST(slp);
+                       if (vi != NULL && VIMPL_TO_VNODE(vi) == vp) {
                                /*
                                 * Put us back on the worklist.  The worklist
                                 * routine will remove us from our current



Home | Main Index | Thread Index | Old Index