diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-03-31 16:08:50 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-03-31 16:08:50 +0000 |
commit | 76104e049288e93adbf73b8769825bcf81cf74bd (patch) | |
tree | 6e664c8c2792bec1d84eda71163cd72bb83a1175 /sys/kern/vfs_lookup.c | |
parent | 1463edcf111b4a3845f2b61e56ec3fe8f4d0b6b9 (diff) | |
download | FreeBSD-src-76104e049288e93adbf73b8769825bcf81cf74bd.zip FreeBSD-src-76104e049288e93adbf73b8769825bcf81cf74bd.tar.gz |
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)
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 464cc05..e38ac71 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -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) |