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
cc: dwmalone@freebsd.org, iedowse@freebsd.org

From: Ian Dowse
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

_______________________________________________
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"