From a3d114851f56159b25a724f5413fb701a0b1c6f6 Mon Sep 17 00:00:00 2001 From: dogcow Date: Tue, 21 Mar 2006 10:22:59 +0000 Subject: [PATCH] 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. --- sys/dev/vnd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 947766e8f0d4..0118cb73fbf9 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -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 -__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;