diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2021-03-02 11:51:00 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2021-03-02 11:51:00 +0000 |
| commit | 87cd84c7ce2c1928bf3b66892f5537904bf6187b (patch) | |
| tree | 005aa92e35b0c5eedebebd7ae3094f8abafa2b08 /sys | |
| parent | 34da1dca438cddb2010fc8602cb09ff46a4d1c27 (diff) | |
Fix previous: Each line is "stride" bytes wide, not "width * depth".
While here, add a comment explaining what this test is doing.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/arm/fdt/arm_simplefb.c | 11 | ||||
| -rw-r--r-- | sys/dev/fdt/simplefb.c | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/arch/arm/fdt/arm_simplefb.c b/sys/arch/arm/fdt/arm_simplefb.c index 1b9e929979a..96765b5420e 100644 --- a/sys/arch/arm/fdt/arm_simplefb.c +++ b/sys/arch/arm/fdt/arm_simplefb.c @@ -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 @@ arm_simplefb_preattach(void) 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 --git a/sys/dev/fdt/simplefb.c b/sys/dev/fdt/simplefb.c index c3803779608..993a1165d9a 100644 --- a/sys/dev/fdt/simplefb.c +++ b/sys/dev/fdt/simplefb.c @@ -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> @@ -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 @@ simplefb_attach_genfb(struct simplefb_softc *sc) return ENXIO; } - if (size < width * height * depth) { + if (size < stride * height) { aprint_error(": incorrect size\n"); return ENXIO; } |
