Source-Changes-HG archive

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

[src/ad-namecache]: src/sys/kern cache_enter(): check namelen before touching...



details:   https://anonhg.NetBSD.org/src/rev/31fc8a8da0e3
branches:  ad-namecache
changeset: 1025013:31fc8a8da0e3
user:      ad <ad%NetBSD.org@localhost>
date:      Wed Jan 08 11:44:30 2020 +0000

description:
cache_enter(): check namelen before touching name.

diffstat:

 sys/kern/vfs_cache.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r e6ec5ee3547f -r 31fc8a8da0e3 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c      Wed Jan 08 11:02:35 2020 +0000
+++ b/sys/kern/vfs_cache.c      Wed Jan 08 11:44:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_cache.c,v 1.126.2.1 2020/01/08 11:02:16 ad Exp $   */
+/*     $NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $   */
 
 /*-
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.
@@ -149,7 +149,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.1 2020/01/08 11:02:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -730,8 +730,8 @@
                ncp->nc_whiteout = false;
                vi = VNODE_TO_VIMPL(vp);
                /* Partially sort the per-vnode list: dots go to back. */
-               if ((name[0] == '.' && namelen == 1) ||
-                   (name[0] == '.' && name[1] == '.' && namelen == 2)) {
+               if ((namelen == 1 && name[0] == '.') ||
+                   (namelen == 2 && name[0] == '.' && name[1] == '.')) {
                        TAILQ_INSERT_TAIL(&vi->vi_nclist, ncp, nc_vlist);
                } else {
                        TAILQ_INSERT_HEAD(&vi->vi_nclist, ncp, nc_vlist);



Home | Main Index | Thread Index | Old Index