Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/omap avoid a crash when the display size is rep...



details:   https://anonhg.NetBSD.org/src/rev/735e035f6ebb
branches:  trunk
changeset: 764154:735e035f6ebb
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Tue Apr 12 18:10:15 2011 +0000

description:
avoid a crash when the display size is reported as 1x1
XXX this is hackish, it should be properly fixed instead

diffstat:

 sys/arch/arm/omap/omapfb.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 162b1ecd299a -r 735e035f6ebb sys/arch/arm/omap/omapfb.c
--- a/sys/arch/arm/omap/omapfb.c        Tue Apr 12 18:09:11 2011 +0000
+++ b/sys/arch/arm/omap/omapfb.c        Tue Apr 12 18:10:15 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: omapfb.c,v 1.1 2010/08/31 19:03:55 macallan Exp $      */
+/*     $NetBSD: omapfb.c,v 1.2 2011/04/12 18:10:15 ahoka Exp $ */
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.1 2010/08/31 19:03:55 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.2 2011/04/12 18:10:15 ahoka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -179,6 +179,11 @@
        sc->sc_depth = 16;
        sc->sc_stride = sc->sc_width << 1;
 
+       if (sc->sc_width == 1 || sc->sc_height == 1) {
+               aprint_error_dev(self, "bogus display size, not attaching\n");
+               return;
+       }
+
        printf("%s: firmware set up %d x %d\n", device_xname(self),
            sc->sc_width, sc->sc_height);
 #if 0



Home | Main Index | Thread Index | Old Index