Module Name: src Committed By: macallan Date: Thu Aug 1 00:20:22 UTC 2024
Modified Files: src/sys/arch/hppa/dev: gftfb.c hyperfb.c Log Message: fix tpyo and properly limit what we can mmap() To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c diff -u src/sys/arch/hppa/dev/gftfb.c:1.16 src/sys/arch/hppa/dev/gftfb.c:1.17 --- src/sys/arch/hppa/dev/gftfb.c:1.16 Wed Jul 17 08:30:28 2024 +++ src/sys/arch/hppa/dev/gftfb.c Thu Aug 1 00:20:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $ */ +/* $NetBSD: gftfb.c,v 1.17 2024/08/01 00:20:22 macallan Exp $ */ /* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */ @@ -868,7 +868,7 @@ gftfb_mmap(void *v, void *vs, off_t offs if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) return -1; - if (offset >= 0 || offset < sc->sc_scr.fblen) { + if (offset >= 0 && offset < sc->sc_scr.fblen) { /* framebuffer */ pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset, prot, BUS_SPACE_MAP_LINEAR); Index: src/sys/arch/hppa/dev/hyperfb.c diff -u src/sys/arch/hppa/dev/hyperfb.c:1.7 src/sys/arch/hppa/dev/hyperfb.c:1.8 --- src/sys/arch/hppa/dev/hyperfb.c:1.7 Wed Jul 31 16:38:00 2024 +++ src/sys/arch/hppa/dev/hyperfb.c Thu Aug 1 00:20:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $ */ +/* $NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $ */ /* * Copyright (c) 2024 Michael Lorenz @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $"); #include "opt_cputype.h" #include "opt_hyperfb.h" @@ -659,7 +659,8 @@ hyperfb_mmap(void *v, void *vs, off_t of if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) return -1; - if (offset >= 0 || offset < 2048 * 1024) { + /* GSC framebuffer space is 16MB */ + if (offset >= 0 && offset < 0x1000000) { /* framebuffer */ pa = bus_space_mmap(sc->sc_iot, sc->sc_base + HCRX_FBOFFSET, offset, prot,