Module Name:    src
Committed By:   maxv
Date:           Sun Jul 14 05:58:44 UTC 2019

Modified Files:
        src/sys/fs/tmpfs: tmpfs_rename.c

Log Message:
Fix uninitialized variable: if 'tvp' is NULL, '*tdep' is not initialized.
This could have caused the KASSERT to wrongfully fire.

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/tmpfs/tmpfs_rename.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_rename.c
diff -u src/sys/fs/tmpfs/tmpfs_rename.c:1.8 src/sys/fs/tmpfs/tmpfs_rename.c:1.9
--- src/sys/fs/tmpfs/tmpfs_rename.c:1.8	Mon Jul  6 10:24:59 2015
+++ src/sys/fs/tmpfs/tmpfs_rename.c	Sun Jul 14 05:58:44 2019
@@ -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 @@ tmpfs_gro_rename(struct mount *mp, kauth
 	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));

Reply via email to