Make sure to copy segments back to the segs array if non-NULL. This is

relied upon by bus_dmamap_load_mbuf_sg() (i.e. all network drivers).

Approved by:	re (kib)
MFC after:	2 weeks
This commit is contained in:
Nathan Whitehorn 2013-09-17 17:29:07 +00:00
parent 0f9d5dc758
commit 58aa4de0aa

View File

@ -847,13 +847,16 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map,
map->nsegs = nsegs;
if (segs != NULL)
memcpy(map->segments, segs, map->nsegs*sizeof(segs[0]));
else
segs = map->segments;
if (dmat->iommu != NULL)
IOMMU_MAP(dmat->iommu, map->segments, &map->nsegs,
dmat->lowaddr, dmat->highaddr, dmat->alignment,
dmat->boundary, dmat->iommu_cookie);
if (segs != NULL)
memcpy(segs, map->segments, map->nsegs*sizeof(segs[0]));
else
segs = map->segments;
return (segs);
}