Date: Mon, 3 Jun 2019 19:19:35 +0000 (UTC) From: Tycho Nightingale <tychon@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348571 - in head/sys: arm64/arm64 x86/iommu x86/x86 Message-ID: <201906031919.x53JJZn7095708@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tychon Date: Mon Jun 3 19:19:35 2019 New Revision: 348571 URL: https://svnweb.freebsd.org/changeset/base/348571 Log: very large dma mappings can cause integer overflow Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20505 Modified: head/sys/arm64/arm64/busdma_bounce.c head/sys/x86/iommu/busdma_dmar.c head/sys/x86/x86/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- head/sys/arm64/arm64/busdma_bounce.c Mon Jun 3 19:15:06 2019 (r348570) +++ head/sys/arm64/arm64/busdma_bounce.c Mon Jun 3 19:19:35 2019 (r348571) @@ -660,7 +660,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmam /* * 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) { Modified: head/sys/x86/iommu/busdma_dmar.c ============================================================================== --- head/sys/x86/iommu/busdma_dmar.c Mon Jun 3 19:15:06 2019 (r348570) +++ head/sys/x86/iommu/busdma_dmar.c Mon Jun 3 19:19:35 2019 (r348571) @@ -686,7 +686,7 @@ dmar_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmam 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) { /* Modified: head/sys/x86/x86/busdma_bounce.c ============================================================================== --- head/sys/x86/x86/busdma_bounce.c Mon Jun 3 19:15:06 2019 (r348570) +++ head/sys/x86/x86/busdma_bounce.c Mon Jun 3 19:19:35 2019 (r348571) @@ -667,7 +667,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmam /* * 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906031919.x53JJZn7095708>