dirhash potential bug

Sam Leffler sam at errno.com
Fri Mar 11 09:21:56 PST 2005


Coverity's analysis tool claims there might be a null bp dereferenced in
ufsdirhash_lookup.  Attached is a patch to add a KASSERT but it'd be
good for someone more familiar with the code to check if a change is
required.

	Sam

-------------- next part --------------
==== //depot/projects/wifi/sys/ufs/ufs/ufs_dirhash.c#3 - /usr/sam/wifi/sys/ufs/ufs/ufs_dirhash.c ====
@@ -420,6 +420,7 @@
 			if (UFS_BLKATOFF(vp, (off_t)blkoff, NULL, &bp) != 0)
 				return (EJUSTRETURN);
 		}
+		KASSERT(bp != NULL, ("no buf?")); 
 		dp = (struct direct *)(bp->b_data + (offset & bmask));
 		if (dp->d_reclen == 0 || dp->d_reclen >
 		    DIRBLKSIZ - (offset & (DIRBLKSIZ - 1))) {



More information about the freebsd-fs mailing list