Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Fix previous: Each line is "stride" bytes wide, ...



details:   https://anonhg.NetBSD.org/src/rev/941f3b7c5c05
branches:  trunk
changeset: 953263:941f3b7c5c05
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Mar 02 11:51:00 2021 +0000

description:
Fix previous: Each line is "stride" bytes wide, not "width * depth".

While here, add a comment explaining what this test is doing.

diffstat:

 sys/arch/arm/fdt/arm_simplefb.c |  11 ++++++++---
 sys/dev/fdt/simplefb.c          |   6 +++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 5da19777acfd -r 941f3b7c5c05 sys/arch/arm/fdt/arm_simplefb.c
--- a/sys/arch/arm/fdt/arm_simplefb.c   Tue Mar 02 11:10:53 2021 +0000
+++ b/sys/arch/arm/fdt/arm_simplefb.c   Tue Mar 02 11:51:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_simplefb.c,v 1.9 2021/03/02 07:02:05 skrll Exp $ */
+/* $NetBSD: arm_simplefb.c,v 1.10 2021/03/02 11:51:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_vcons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.9 2021/03/02 07:02:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.10 2021/03/02 11:51:00 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -237,8 +237,13 @@
                return;
        }
 
-       if (size < width * height * depth)
+       /*
+        * Make sure that the size of the linear FB mapping is big enough
+        * to fit the requested screen dimensions.
+        */
+       if (size < stride * height) {
                return;
+       }
 
        if (bus_space_map(bst, addr, size,
            BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh) != 0)
diff -r 5da19777acfd -r 941f3b7c5c05 sys/dev/fdt/simplefb.c
--- a/sys/dev/fdt/simplefb.c    Tue Mar 02 11:10:53 2021 +0000
+++ b/sys/dev/fdt/simplefb.c    Tue Mar 02 11:51:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simplefb.c,v 1.13 2021/03/02 07:02:06 skrll Exp $ */
+/* $NetBSD: simplefb.c,v 1.14 2021/03/02 11:51:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.13 2021/03/02 07:02:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.14 2021/03/02 11:51:00 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -169,7 +169,7 @@
                return ENXIO;
        }
 
-       if (size < width * height * depth) {
+       if (size < stride * height) {
                aprint_error(": incorrect size\n");
                return ENXIO;
        }



Home | Main Index | Thread Index | Old Index