From owner-svn-src-head@freebsd.org Mon Jun 3 19:19:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1730515BB162; Mon, 3 Jun 2019 19:19:37 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B0D1A6AD5E; Mon, 3 Jun 2019 19:19:36 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70BF0A707; Mon, 3 Jun 2019 19:19:36 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x53JJadc095711; Mon, 3 Jun 2019 19:19:36 GMT (envelope-from tychon@FreeBSD.org) Received: (from tychon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x53JJZn7095708; Mon, 3 Jun 2019 19:19:35 GMT (envelope-from tychon@FreeBSD.org) Message-Id: <201906031919.x53JJZn7095708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tychon set sender to tychon@FreeBSD.org using -f From: Tycho Nightingale Date: Mon, 3 Jun 2019 19:19:35 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: tychon X-SVN-Commit-Paths: in head/sys: arm64/arm64 x86/iommu x86/x86 X-SVN-Commit-Revision: 348571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B0D1A6AD5E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2019 19:19:37 -0000 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) {