Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/acpi Do not attach simplefb if the width or hei...



details:   https://anonhg.NetBSD.org/src/rev/6aa6e8cef369
branches:  trunk
changeset: 1006705:6aa6e8cef369
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 24 10:49:41 2020 +0000

description:
Do not attach simplefb if the width or height are invalid

diffstat:

 sys/arch/arm/acpi/acpi_simplefb.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r e5943de8e5ac -r 6aa6e8cef369 sys/arch/arm/acpi/acpi_simplefb.c
--- a/sys/arch/arm/acpi/acpi_simplefb.c Fri Jan 24 10:15:40 2020 +0000
+++ b/sys/arch/arm/acpi/acpi_simplefb.c Fri Jan 24 10:49:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_simplefb.c,v 1.1 2019/09/22 18:31:59 jmcneill Exp $ */
+/* $NetBSD: acpi_simplefb.c,v 1.2 2020/01/24 10:49:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_simplefb.c,v 1.1 2019/09/22 18:31:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_simplefb.c,v 1.2 2020/01/24 10:49:41 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -166,6 +166,9 @@
            (format = fdtbus_get_string(phandle, "format")) == NULL)
                return;
 
+       if (width == 0 || height == 0)
+               return;
+
        if (strcmp(format, "a8b8g8r8") == 0 ||
            strcmp(format, "x8r8g8b8") == 0) {
                depth = 32;
@@ -198,6 +201,9 @@
        vcons_init_screen(&acpi_simplefb_vcons_data, &acpi_simplefb_screen, 1, &defattr);
        acpi_simplefb_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;    
 
+       if (ri->ri_rows < 1 || ri->ri_cols < 1)
+               return;
+
        acpi_simplefb_stdscreen.nrows = ri->ri_rows;
        acpi_simplefb_stdscreen.ncols = ri->ri_cols;
        acpi_simplefb_stdscreen.textops = &ri->ri_ops;



Home | Main Index | Thread Index | Old Index