Module Name: src Committed By: phx Date: Sat Feb 12 17:15:27 UTC 2011
Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Fixed NULL-pointer dereferencing when a mode-callback is not defined. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.35 src/sys/dev/wsfb/genfb.c:1.36 --- src/sys/dev/wsfb/genfb.c:1.35 Wed Feb 9 13:19:19 2011 +++ src/sys/dev/wsfb/genfb.c Sat Feb 12 17:15:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -235,7 +235,7 @@ sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens}; memcpy(&sc->sc_ops, ops, sizeof(struct genfb_ops)); sc->sc_mode = WSDISPLAYIO_MODE_EMUL; - if (sc->sc_modecb->gmc_setmode) + if (sc->sc_modecb != NULL) sc->sc_modecb->gmc_setmode(sc, sc->sc_mode); #ifdef GENFB_SHADOWFB @@ -386,7 +386,7 @@ if (new_mode != sc->sc_mode) { sc->sc_mode = new_mode; - if (sc->sc_modecb->gmc_setmode) + if (sc->sc_modecb != NULL) sc->sc_modecb->gmc_setmode(sc, sc->sc_mode); if (new_mode == WSDISPLAYIO_MODE_EMUL) {