Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1742746
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] dma-debug: fix incorrect pfn calculation |
| Date | 2017-10-01 10:10 +0200 |
| Message-ID | <uvHu1-80s-3@gated-at.bofh.it> (permalink) |
| References | <uubwe-5mb-5@gated-at.bofh.it> <uuhLj-1aF-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Sep 27, 2017 at 11:23:52AM +0100, Robin Murphy wrote: > > I found that debug_dma_alloc_coherent() and debug_dma_free_coherent() > > assume that dma_alloc_coherent() always returns a linear address. > > However it's possible that dma_alloc_coherent() returns a non-linear > > address. In this case, page_to_pfn(virt_to_page(virt)) will return an > > incorrect pfn. If the pfn is valid and mapped as a COW page, > > we will hit the warning when doing wp_page_copy(). Hmm, can the debug code assume anything? Right now you're just patching it from supporting linear and vmalloc. But what about other potential mapping types? > > + entry->pfn = is_vmalloc_addr(virt) ? vmalloc_to_pfn(virt) : > > + page_to_pfn(virt_to_page(virt)); Please use normal if/else conditionsals: if (is_vmalloc_addr(virt)) entry->pfn = vmalloc_to_pfn(virt); else entry->pfn = page_to_pfn(virt_to_page(virt)); > > + .pfn = is_vmalloc_addr(virt) ? vmalloc_to_pfn(virt) : > > + page_to_pfn(virt_to_page(virt)), Same here.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3] dma-debug: fix incorrect pfn calculation <miles.chen@mediatek.com> - 2017-09-27 05:50 +0200
Re: [PATCH v3] dma-debug: fix incorrect pfn calculation Robin Murphy <robin.murphy@arm.com> - 2017-09-27 12:30 +0200
Re: [PATCH v3] dma-debug: fix incorrect pfn calculation Christoph Hellwig <hch@lst.de> - 2017-10-01 10:10 +0200
Re: [PATCH v3] dma-debug: fix incorrect pfn calculation Miles Chen <miles.chen@mediatek.com> - 2017-10-02 12:40 +0200
csiph-web