busdma: _bus_dmamap_addseg repaired
A recent change introduced a one-off error into a test allowing
coalescing chunks into segments. This fixes that error.
broke a check in _bus_dmamap_addseg on many architectures. This change makes it clear that it is not a particular range that is being boundary-checked, but the proposed union of the two adjacent ranges.
Reported by: se
Reviewed by: se
Fixes: c606ab59e7
vm_extern: use standard address checkers everywhere
Differential Revision: https://reviews.freebsd.org/D33715
This commit is contained in:
parent
1b90dfa5d2
commit
f1e7a532d1
@ -1027,8 +1027,8 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
|
||||
} else {
|
||||
if (curaddr == segs[seg].ds_addr + segs[seg].ds_len &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->maxsegsz &&
|
||||
vm_addr_bound_ok(segs[seg].ds_addr, segs[seg].ds_len,
|
||||
dmat->boundary))
|
||||
vm_addr_bound_ok(segs[seg].ds_addr,
|
||||
segs[seg].ds_len + sgsize, dmat->boundary))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->nsegments)
|
||||
|
@ -787,8 +787,8 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
|
||||
} else {
|
||||
if (curaddr == segs[seg].ds_addr + segs[seg].ds_len &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->common.maxsegsz &&
|
||||
vm_addr_bound_ok(segs[seg].ds_addr, segs[seg].ds_len,
|
||||
dmat->common.boundary))
|
||||
vm_addr_bound_ok(segs[seg].ds_addr,
|
||||
segs[seg].ds_len + sgsize, dmat->common.boundary))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->common.nsegments)
|
||||
|
@ -708,8 +708,8 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
|
||||
} else {
|
||||
if (curaddr == segs[seg].ds_addr + segs[seg].ds_len &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->maxsegsz &&
|
||||
vm_addr_bound_ok(segs[seg].ds_addr, segs[seg].ds_len,
|
||||
dmat->boundary))
|
||||
vm_addr_bound_ok(segs[seg].ds_addr,
|
||||
segs[seg].ds_len + sgsize, dmat->boundary))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->nsegments)
|
||||
|
@ -656,8 +656,8 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
|
||||
} else {
|
||||
if (curaddr == segs[seg].ds_addr + segs[seg].ds_len &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->common.maxsegsz &&
|
||||
vm_addr_bound_ok(segs[seg].ds_addr, segs[seg].ds_len,
|
||||
dmat->common.boundary))
|
||||
vm_addr_bound_ok(segs[seg].ds_addr,
|
||||
segs[seg].ds_len + sgsize, dmat->common.boundary))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->common.nsegments)
|
||||
|
@ -718,8 +718,8 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t curaddr,
|
||||
} else {
|
||||
if (curaddr == segs[seg].ds_addr + segs[seg].ds_len &&
|
||||
(segs[seg].ds_len + sgsize) <= dmat->common.maxsegsz &&
|
||||
vm_addr_bound_ok(segs[seg].ds_addr, segs[seg].ds_len,
|
||||
dmat->common.boundary))
|
||||
vm_addr_bound_ok(segs[seg].ds_addr,
|
||||
segs[seg].ds_len + sgsize, dmat->common.boundary))
|
||||
segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= dmat->common.nsegments)
|
||||
|
Loading…
Reference in New Issue
Block a user