Add assertion to make sure that the segment index is in valid range.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 16 Jan 2009 11:41:23 +0000 (19:41 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 17 Feb 2009 10:35:04 +0000 (18:35 +0800)
sys/platform/pc32/i386/busdma_machdep.c

index fa3eed4..45df1ee 100644 (file)
@@ -574,7 +574,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
                BZ_UNLOCK(bz);
        }
 
-       KKASSERT(*segp >= 1);
+       KKASSERT(*segp >= 1 && *segp <= dmat->nsegments);
        seg = *segp;
        sg = &dmat->segments[seg - 1];