Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2005 14:31:15 -0500
From:      Stephan Uphoff <ups@tree.com>
To:        Sam Leffler <sam@errno.com>
Cc:        fs@freebsd.org
Subject:   Re: dirhash potential bug
Message-ID:  <1110569475.29804.23911.camel@palm>
In-Reply-To: <4231D417.9060705@errno.com>
References:  <4231D417.9060705@errno.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2005-03-11 at 12:23, Sam Leffler wrote:
> 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

In my opinion the change is not required.
Not knowing how the tool works my guess is that the function pointer
um_blkatoff used in UFS_BLKATOFF makes it impossible for the tool to
prove that bp will always be non-zero at this point.

Can you replace UFS_BLKATOFF(vp, (off_t)blkoff, NULL, &bp) with
ffs_blkatoff(vp, (off_t)blkoff, NULL, &bp) and rerun the test?

Stephan
> 
> ______________________________________________________________________
> ==== //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))) {
> 
> 
> ______________________________________________________________________
> _______________________________________________
> freebsd-fs@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1110569475.29804.23911.camel>