Module Name: src
Committed By: jmcneill
Date: Fri Jan 24 10:49:41 UTC 2020
Modified Files:
src/sys/arch/arm/acpi: acpi_simplefb.c
Log Message:
Do not attach simplefb if the width or height are invalid
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/acpi/acpi_simplefb.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/arch/arm/acpi/acpi_simplefb.c
diff -u src/sys/arch/arm/acpi/acpi_simplefb.c:1.1 src/sys/arch/arm/acpi/acpi_simplefb.c:1.2
--- src/sys/arch/arm/acpi/acpi_simplefb.c:1.1 Sun Sep 22 18:31:59 2019
+++ src/sys/arch/arm/acpi/acpi_simplefb.c Fri Jan 24 10:49:41 2020
@@ -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 @@ acpi_simplefb_preattach(void)
(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 @@ acpi_simplefb_preattach(void)
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;