Fix uninitialized variable: if 'tvp' is NULL, '*tdep' is not initialized. trunk
authormaxv <maxv@NetBSD.org>
Sun, 14 Jul 2019 05:58:44 +0000
branchtrunk
changeset 452557 de37614ba954
parent 452556 5e11b2618cc2
child 452558 8a14ba377e0e
Fix uninitialized variable: if 'tvp' is NULL, '*tdep' is not initialized. This could have caused the KASSERT to wrongfully fire. ok riastradh@
sys/fs/tmpfs/tmpfs_rename.c
--- a/sys/fs/tmpfs/tmpfs_rename.c	Sat Jul 13 21:56:23 2019 +0000
+++ b/sys/fs/tmpfs/tmpfs_rename.c	Sun Jul 14 05:58:44 2019 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_rename.c,v 1.8 2015/07/06 10:24:59 wiz Exp $	*/
+/*	$NetBSD: tmpfs_rename.c,v 1.9 2019/07/14 05:58:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_rename.c,v 1.8 2015/07/06 10:24:59 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_rename.c,v 1.9 2019/07/14 05:58:44 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -282,7 +282,7 @@
 	KASSERT(tcnp != NULL);
 	KASSERT(tdep != NULL);
 	KASSERT(fdep != tdep);
-	KASSERT((*fdep) != (*tdep));
+	KASSERT((tvp == NULL) || (*fdep) != (*tdep));
 	KASSERT((*fdep) != NULL);
 	KASSERT((*fdep)->td_node == VP_TO_TMPFS_NODE(fvp));
 	KASSERT((tvp == NULL) || ((*tdep) != NULL));