Rather than ignoring any error return from getnewvnode() in nameiinit(),

explicitly test and panic.  This should not ever happen, but if it does,
this is a preferred failure mode to a NULL pointer dereference in kernel.

Coverity CID:	1716
Found with:	Coverity Prevent(tm)
This commit is contained in:
Robert Watson 2007-03-31 16:08:50 +00:00
parent 4abab3d593
commit e92d773fbc

View File

@ -77,9 +77,13 @@ static struct vnode *vp_crossmp;
static void
nameiinit(void *dummy __unused)
{
int error;
namei_zone = uma_zcreate("NAMEI", MAXPATHLEN, NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
getnewvnode("crossmp", NULL, &dead_vnodeops, &vp_crossmp);
error = getnewvnode("crossmp", NULL, &dead_vnodeops, &vp_crossmp);
if (error != 0)
panic("nameiinit: getnewvnode");
vp_crossmp->v_vnlock->lk_flags &= ~LK_NOSHARE;
}
SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nameiinit, NULL)