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/33b3f1890fb7
branches: trunk
changeset: 846420:33b3f1890fb7
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Nov 16 10:07:53 2019 +0000
description:
NULL-check the structure pointer, not the address of its first field. Also
add KASSERT. For clarity, and to appease kUBSan.
diffstat:
sys/kern/vfs_mount.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (33 lines):
diff -r 45ac2c3f6485 -r 33b3f1890fb7 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Sat Nov 16 10:05:44 2019 +0000
+++ b/sys/kern/vfs_mount.c Sat Nov 16 10:07:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.71 2019/08/19 09:32:42 christos Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.72 2019/11/16 10:07:53 maxv Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.71 2019/08/19 09:32:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.72 2019/11/16 10:07:53 maxv Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -420,11 +420,12 @@
TAILQ_REMOVE(&mp->mnt_vnodelist, mvip, vi_mntvnodes);
VIMPL_TO_VNODE(mvip)->v_usecount = 0;
again:
- vp = VIMPL_TO_VNODE(vip);
- if (vp == NULL) {
+ if (vip == NULL) {
mutex_exit(&mntvnode_lock);
return NULL;
}
+ vp = VIMPL_TO_VNODE(vip);
+ KASSERT(vp != NULL);
mutex_enter(vp->v_interlock);
if (vnis_marker(vp) ||
vdead_check(vp, (do_wait ? 0 : VDEAD_NOWAIT)) ||
Home |
Main Index |
Thread Index |
Old Index