Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev return quickly from the GET ioctl to avoid playing w...



details:   https://anonhg.NetBSD.org/src/rev/4f502395256b
branches:  trunk
changeset: 335234:4f502395256b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 30 20:18:44 2014 +0000

description:
return quickly from the GET ioctl to avoid playing with NULL.

diffstat:

 sys/dev/cgd.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r f5c6df41dddd -r 4f502395256b sys/dev/cgd.c
--- a/sys/dev/cgd.c     Tue Dec 30 19:11:44 2014 +0000
+++ b/sys/dev/cgd.c     Tue Dec 30 20:18:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.92 2014/12/29 18:23:57 mlelstv Exp $ */
+/* $NetBSD: cgd.c,v 1.93 2014/12/30 20:18:44 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.92 2014/12/29 18:23:57 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.93 2014/12/30 20:18:44 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -554,10 +554,8 @@
            dev, cmd, data, flag, l));
 
        switch (cmd) {
-       case CGDIOCGET: /* don't call cgd_spawn() if the device isn't there */
-               cs = NULL;
-               dksc = NULL;
-               break;
+       case CGDIOCGET:
+               return cgd_ioctl_get(dev, data, l);
        case CGDIOCSET:
        case CGDIOCCLR:
                if ((flag & FWRITE) == 0)
@@ -582,8 +580,6 @@
                if (DK_BUSY(&cs->sc_dksc, pmask))
                        return EBUSY;
                return cgd_ioctl_clr(cs, l);
-       case CGDIOCGET:
-               return cgd_ioctl_get(dev, data, l);
        case DIOCCACHESYNC:
                /*
                 * XXX Do we really need to care about having a writable
@@ -598,6 +594,9 @@
                return VOP_IOCTL(cs->sc_tvn, cmd, data, flag, l->l_cred);
        default:
                return dk_ioctl(di, dksc, dev, cmd, data, flag, l);
+       case CGDIOCGET:
+               KASSERT(0);
+               return EINVAL;
        }
 }
 



Home | Main Index | Thread Index | Old Index