Module Name:    src
Committed By:   drochner
Date:           Fri Sep 10 10:14:56 UTC 2010

Modified Files:
        src/sys/kern: vfs_wapbl.c

Log Message:
fix two bugs reported by Ryo Shimizu:
-wrong initialization reported in a followup to PR bin/43336
 (looks harmless because it applies to zero-initialized memory, so
 LIST_INIT() is a no-op)
-wrong loop count in reply misses a hash bucket (PR kern/43827)
 (this was introduced by a post-netbsd-5 change, so it isn't related
 to the PR above)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/vfs_wapbl.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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.36 src/sys/kern/vfs_wapbl.c:1.37
--- src/sys/kern/vfs_wapbl.c:1.36	Wed Apr 21 19:50:57 2010
+++ src/sys/kern/vfs_wapbl.c	Fri Sep 10 10:14:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.36 2010/04/21 19:50:57 pooka Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.37 2010/09/10 10:14:55 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.36 2010/04/21 19:50:57 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.37 2010/09/10 10:14:55 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -2095,7 +2095,7 @@
 		for (hashsize = 1; hashsize < size; hashsize <<= 1)
 			continue;
 		wr->wr_blkhash = wapbl_malloc(hashsize * sizeof(*wr->wr_blkhash));
-		for (i = 0; i < wr->wr_blkhashmask; i++)
+		for (i = 0; i < hashsize; i++)
 			LIST_INIT(&wr->wr_blkhash[i]);
 		wr->wr_blkhashmask = hashsize - 1;
 	}
@@ -2648,7 +2648,7 @@
 
 	scratch = wapbl_malloc(MAXBSIZE);
 
-	for (i = 0; i < wr->wr_blkhashmask; ++i) {
+	for (i = 0; i <= wr->wr_blkhashmask; ++i) {
 		LIST_FOREACH(wb, &wr->wr_blkhash[i], wb_hash) {
 			off = wb->wb_off;
 			error = wapbl_circ_read(wr, scratch, fsblklen, &off);

Reply via email to