as yamt and bouyer pointed out, there are a few other cases where l should

be checked for NULL, if one's going to do it at all, and that the proper idiom
is KASSERT, not panic.
This commit is contained in:
dogcow 2006-03-21 10:22:59 +00:00
parent c38d26c2d6
commit a3d114851f
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.142 2006/03/18 01:13:24 dogcow Exp $ */
/* $NetBSD: vnd.c,v 1.143 2006/03/21 10:22:59 dogcow Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -133,7 +133,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.142 2006/03/18 01:13:24 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.143 2006/03/21 10:22:59 dogcow Exp $");
#if defined(_KERNEL_OPT)
#include "fs_nfs.h"
@ -868,6 +868,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, vio->vnd_file, l);
if ((error = vn_open(&nd, fflags, 0)) != 0)
goto unlock_and_exit;
KASSERT(l);
error = VOP_GETATTR(nd.ni_vp, &vattr, l->l_proc->p_ucred, l);
if (!error && nd.ni_vp->v_type != VREG)
error = EOPNOTSUPP;
@ -1150,6 +1151,7 @@ unlock_and_exit:
struct vnd_ouser *vnu;
struct vattr va;
vnu = (struct vnd_ouser *)data;
KASSERT(l);
switch (error = vnd_cget(l, unit, &vnu->vnu_unit, &va)) {
case 0:
vnu->vnu_dev = va.va_fsid;
@ -1170,7 +1172,7 @@ unlock_and_exit:
struct vnd_user *vnu;
struct vattr va;
vnu = (struct vnd_user *)data;
if (l == NULL) panic("VNDIOCGET: lwp == NULL!");
KASSERT(l);
switch (error = vnd_cget(l, unit, &vnu->vnu_unit, &va)) {
case 0:
vnu->vnu_dev = va.va_fsid;