Messages in this thread | | | Date | Mon, 7 Mar 2016 14:59:07 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL |
| |
On Mon, 7 Mar 2016 18:43:47 +0800 "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> wrote:
> Suppose: > CONFIG_SPARSEMEM is opened. > CONFIG_DMA_API_DEBUG or CONFIG_CMA is opened. > > Then virt_to_page or phys_to_page will be called. Finally, in __pfn_to_page, __sec = __pfn_to_section(__pfn) is NULL. > So access section->section_mem_map will trigger exception. > > --------- > > #define __pfn_to_page(pfn) \ > ({ unsigned long __pfn = (pfn); \ > struct mem_section *__sec = __pfn_to_section(__pfn); \ > __section_mem_map_addr(__sec) + __pfn; \ > }) > > static inline struct page *__section_mem_map_addr(struct mem_section *section) > { > unsigned long map = section->section_mem_map; > map &= SECTION_MAP_MASK; > return (struct page *)map; > }
I'm having a bit of trouble understanding this.
Perhaps you could explain the bug more carefully (inclusion of an oops output would help) then we'll be in a better position to understand the proposed fix(es).
Thanks.
| |