Date: Tue, 12 Jul 2022 17:32:35 GMT From: Doug Moore <dougm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 01f79c9da806 - stable/13 - busdma: _bus_dmamap_addseg repaired Message-ID: <202207121732.26CHWZOa065591@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=01f79c9da806b7e64fc250c516b04e9e12a8d7bb commit 01f79c9da806b7e64fc250c516b04e9e12a8d7bb Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2022-01-02 18:37:05 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2022-07-12 16:26:11 +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 (cherry picked from commit f1e7a532d1ee23033fe0f3beb8eee80c412eeefe) --- 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 dc2ed002fab6..3cd4abe902f1 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 be48cdd6975f..fb631823d32f 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -784,8 +784,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 80054335782a..cfe4dc862d19 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -698,8 +698,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207121732.26CHWZOa065591>