From 75b7de1b56a2b61c21fcc2d499674a4138968153 Mon Sep 17 00:00:00 2001 From: mjg Date: Thu, 20 Oct 2016 19:55:50 +0000 Subject: [PATCH] cache: fix up a corner case in r307650 If no negative entry is found on the last list, the ncp pointer will be left uninitialized and a non-null value will make the function assume an entry was found. Fix the problem by initializing to NULL on entry. Reported by: glebius --- sys/kern/vfs_cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index a112808cad39..6101f186f938 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -763,6 +763,8 @@ cache_negative_shrink_select(int start, struct namecache **ncpp, struct namecache *ncp; int i; + *ncpp = ncp = NULL; + for (i = start; i < numneglists; i++) { neglist = &neglists[i]; if (TAILQ_FIRST(&neglist->nl_list) == NULL)