getblk() may return NULL, but most caller's don't check for it

Bob Willcox bob at immure.com
Thu Sep 4 08:47:00 PDT 2003


Hi All,

While perusing the FreeBSD kernel source code today I noticed that
there are several reasons that the getblk() function in vfs_bio.c might
decide to return a NULL return code. However, checking both 4-stable and
5-current I can find only place (in 5-curren) where the return value
from getblk() is actually checked for the possibility of being NULL (in
function cluster_rbuild() in vfs_cluster.c near line 389). In all other
instances that I can find the returned value is quickly dereferenced w/o
any check.

What am I missing here? Is this really a bug, or are there extenuating
circumstances that prevent getblk() from returning NULL in actual
operation?

Thanks for any insight that you may provide.
Bob

-- 
Bob Willcox                  Maslow's Maxim:
bob at immure.com                   If the only tool you have is a hammer,
Austin, TX                       you treat everything like a nail.


More information about the freebsd-hackers mailing list