very large dma mappings can cause integer overflow
Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20505
This commit is contained in:
parent
22bba3db5e
commit
e0b11c4354
@ -660,7 +660,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags)
|
||||
/*
|
||||
* Add a single contiguous physical range to the segment list.
|
||||
*/
|
||||
static int
|
||||
static bus_size_t
|
||||
_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
|
||||
bus_size_t sgsize, bus_dma_segment_t *segs, int *segp)
|
||||
{
|
||||
|
@ -686,7 +686,7 @@ dmar_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map1,
|
||||
return (ENOMEM);
|
||||
fma = NULL;
|
||||
for (i = 0; i < ma_cnt; i++) {
|
||||
paddr = pstart + i * PAGE_SIZE;
|
||||
paddr = pstart + ptoa(i);
|
||||
ma[i] = PHYS_TO_VM_PAGE(paddr);
|
||||
if (ma[i] == NULL || VM_PAGE_TO_PHYS(ma[i]) != paddr) {
|
||||
/*
|
||||
|
@ -667,7 +667,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags)
|
||||
/*
|
||||
* Add a single contiguous physical range to the segment list.
|
||||
*/
|
||||
static int
|
||||
static bus_size_t
|
||||
_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t curaddr,
|
||||
bus_size_t sgsize, bus_dma_segment_t *segs, int *segp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user