Avoid a NULL pointer dereference in bounce_bus_dmamap_sync() when the

map has been created via bounce_bus_dmamem_alloc(). Even for coherent
DMA - which bus_dmamem_alloc(9) typically is used for -, calling of
bus_dmamap_sync(9) isn't optional.

PR:		188899 (non-original problem)
MFC after:	3 days
This commit is contained in:
marius 2015-11-20 02:23:35 +00:00
parent beef81f726
commit ac288bbb4a
2 changed files with 2 additions and 2 deletions

View File

@ -767,7 +767,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
struct bounce_page *bpage;
vm_offset_t datavaddr, tempvaddr;
if ((bpage = STAILQ_FIRST(&map->bpages)) == NULL)
if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL)
return;
/*

View File

@ -892,7 +892,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
vm_offset_t datavaddr, tempvaddr;
bus_size_t datacount1, datacount2;
if ((bpage = STAILQ_FIRST(&map->bpages)) == NULL)
if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL)
return;
/*