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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255639

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);
}