From: hann...@netbsd.org Date: Thu, 20 Dec 2012 08:03:46 +0000 --- sys/fs/msdosfs/msdosfs_vnops.c 29 Apr 2012 22:53:59 -0000 1.83 +++ sys/fs/msdosfs/msdosfs_vnops.c 20 Dec 2012 08:03:42 -0000 1.84 @@ -527,7 +527,6 @@ msdosfs_read(void *v) NOCRED, 0, &bp); n = MIN(n, pmp->pm_bpcluster - bp->b_resid); if (error) { - brelse(bp, 0);
Looks like you need to move the initialization of n to after the error branch. --- sys/ufs/ext2fs/ext2fs_vfsops.c 21 Nov 2012 23:11:23 -0000 1.167 +++ sys/ufs/ext2fs/ext2fs_vfsops.c 20 Dec 2012 08:03:44 -0000 1.168 @@ -772,8 +770,8 @@ ext2fs_mountfs(struct vnode *devvp, stru return (0); out: - KASSERT(bp != NULL); - brelse(bp, 0); + if (bp != NULL) + brelse(bp, 0); Are bread &c. supposed to guarantee that bp is null on error, or are they supposed to leave it in an undefined state? Either way, it seems to me that the intent ought to be documented in buffercache(9).