git: f1e7a532d1ee - main - busdma: _bus_dmamap_addseg repaired
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Jan 2022 18:43:00 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=f1e7a532d1ee23033fe0f3beb8eee80c412eeefe commit f1e7a532d1ee23033fe0f3beb8eee80c412eeefe Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2022-01-02 18:37:05 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2022-01-02 18:37:05 +0000 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: c606ab59e7f9 vm_extern: use standard address checkers everywhere Differential Revision: https://reviews.freebsd.org/D33715 --- sys/arm/arm/busdma_machdep.c | 4 ++-- sys/arm64/arm64/busdma_bounce.c | 4 ++-- sys/powerpc/powerpc/busdma_machdep.c | 4 ++-- sys/riscv/riscv/busdma_bounce.c | 4 ++-- sys/x86/x86/busdma_bounce.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 55e02bc122a1..d2abb0d46dbd 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -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) diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index 0597b6ae8187..701411ba5b74 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -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) diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 3826a380f793..f75d3e1efcf9 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -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) diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c index 062f752f5ceb..ffc05e20517f 100644 --- a/sys/riscv/riscv/busdma_bounce.c +++ b/sys/riscv/riscv/busdma_bounce.c @@ -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) diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index 7da2ca0631ef..0d17869f8e17 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -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)