Module Name: src Committed By: christos Date: Tue Dec 30 20:18:44 UTC 2014
Modified Files: src/sys/dev: cgd.c Log Message: return quickly from the GET ioctl to avoid playing with NULL. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/dev/cgd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/cgd.c diff -u src/sys/dev/cgd.c:1.92 src/sys/dev/cgd.c:1.93 --- src/sys/dev/cgd.c:1.92 Mon Dec 29 13:23:57 2014 +++ src/sys/dev/cgd.c Tue Dec 30 15:18:44 2014 @@ -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 @@ cgdioctl(dev_t dev, u_long cmd, void *da 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 @@ cgdioctl(dev_t dev, u_long cmd, void *da 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 @@ cgdioctl(dev_t dev, u_long cmd, void *da 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; } }