Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs Fix uninitialized variable: if 'tvp' is NULL, '...



details:   https://anonhg.NetBSD.org/src/rev/8e6522271e71
branches:  trunk
changeset: 457709:8e6522271e71
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jul 14 05:58:44 2019 +0000

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

ok riastradh@

diffstat:

 sys/fs/tmpfs/tmpfs_rename.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9351c5f48697 -r 8e6522271e71 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));



Home | Main Index | Thread Index | Old Index