Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2005 19:10:38 +0000
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Sam Leffler <sam@errno.com>
Cc:        fs@freebsd.org
Subject:   Re: dirhash potential bug 
Message-ID:  <200503111910.aa12186@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Fri, 11 Mar 2005 09:23:35 PST." <4231D417.9060705@errno.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <4231D417.9060705@errno.com>, Sam Leffler writes:
>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, maybe you missed my reply to your original message about this?
Here it is again anyway.

Ian

(Message freebsd-commit:11710)
 -- using template mhl.format --
Date:    Thu, 24 Feb 2005 01:32:24 GMT
To:      Sam Leffler <sam@errno.com>
cc:      dwmalone@freebsd.org, iedowse@freebsd.org

From:    Ian Dowse <iedowse@maths.tcd.ie>
Subject: Re: dirhash potential bug 

In message <421D0D59.1090001@errno.com>, Sam Leffler writes:
>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 (the analysis tool can be fooled by indirect logic).
>
>If you commit a change (even this assert) please make sure you mark the 
>commit with attribution.  If this cannot happen please let me know so I 
>can mark the analysis db I'm going through.  Thanks.

Hi Sam,

As far as I can tell the code is safe as is. Simplified it looks
like this:

	blkoff = -1;
	bp = NULL;
	for (...) {
		offset = non-negative value;
		if ((offset & ~bmask) != blkoff)
			bp = non-NULL;
		[dereference bp]
	}

So it is guaranteed that `((offset & ~bmask) != blkoff)' will be true
the first time around the loop and hence bp will be non-NULL.

Does that seem ok?

Ian



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