Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Check for programming errors in _bus_dmam...



details:   https://anonhg.NetBSD.org/src/rev/95d48155502c
branches:  trunk
changeset: 959287:95d48155502c
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Feb 07 10:47:40 2021 +0000

description:
Check for programming errors in _bus_dmamap_load_buffer

diffstat:

 sys/arch/arm/arm32/bus_dma.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 7e5b57455bdb -r 95d48155502c sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Sun Feb 07 10:20:35 2021 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Sun Feb 07 10:47:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.131 2021/02/07 10:20:35 skrll Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.132 2021/02/07 10:47:40 skrll Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.131 2021/02/07 10:20:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.132 2021/02/07 10:47:40 skrll Exp $");
 
 #include <sys/param.h>
 
@@ -1633,7 +1633,14 @@
                 *
                 */
                bool coherent;
-               pmap_extract_coherency(pmap, vaddr, &curaddr, &coherent);
+               bool ok __diagused;
+               ok = pmap_extract_coherency(pmap, vaddr, &curaddr, &coherent);
+
+               /*
+                * trying to bus_dmamap_load an unmapped buffer is a
+                * programming error.
+                */
+               KASSERT(ok);
 
                KASSERTMSG((vaddr & PAGE_MASK) == (curaddr & PAGE_MASK),
                    "va %#lx curaddr %#lx", vaddr, curaddr);



Home | Main Index | Thread Index | Old Index