diff options
author | 2011-04-03 22:33:55 +0000 | |
---|---|---|
committer | 2011-04-03 22:33:55 +0000 | |
commit | 07406c76f16b0e7aa3745c5844f9c139e4d37bb7 (patch) | |
tree | 85bda8b56df6e9f262fa2e7e92e43e3e71a5d48b /sys | |
parent | Make sure dma_constraint is listed in uvm_md_constraints[] when it does not (diff) | |
download | wireguard-openbsd-07406c76f16b0e7aa3745c5844f9c139e4d37bb7.tar.xz wireguard-openbsd-07406c76f16b0e7aa3745c5844f9c139e4d37bb7.zip |
Add a consistency check for the value returned by pmap_extract() against the
dma_constraints range in _dmamap_load_buffer. From and ok beck@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sgi/sgi/bus_dma.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/sgi/sgi/bus_dma.c b/sys/arch/sgi/sgi/bus_dma.c index 49879ab4d89..8555822a9f9 100644 --- a/sys/arch/sgi/sgi/bus_dma.c +++ b/sys/arch/sgi/sgi/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.20 2010/12/26 15:41:00 miod Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.21 2011/04/03 22:33:55 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -61,7 +61,7 @@ #include <sys/malloc.h> #include <sys/mbuf.h> -#include <uvm/uvm_extern.h> +#include <uvm/uvm.h> #include <mips64/archtype.h> #include <machine/cpu.h> @@ -576,6 +576,13 @@ _dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf, panic("_dmapmap_load_buffer: pmap_extract(%x, %x) failed!", pmap, vaddr); +#ifdef DIAGNOSTIC + if (curaddr > dma_constraint.ucr_high || + curaddr < dma_constraint.ucr_low) + panic("Non DMA-reachable buffer at curaddr %p (raw)", + curaddr); +#endif + /* * Compute the segment size, and adjust counts. */ |