Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

2016-03-07 Thread Leizhen (ThunderTown)
On 2016/3/8 6:59, Andrew Morton wrote: > On Mon, 7 Mar 2016 18:43:47 +0800 "Leizhen (ThunderTown)" > 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

Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

2016-03-07 Thread Andrew Morton
On Mon, 7 Mar 2016 18:43:47 +0800 "Leizhen (ThunderTown)" 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 sect

Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

2016-03-07 Thread Leizhen (ThunderTown)
On 2016/3/7 19:41, One Thousand Gnomes wrote: > On Mon, 7 Mar 2016 17:21:25 +0800 > Zhen Lei wrote: > >> Do this to keep consistent with kfree, which tolerate ptr is NULL. >> >> Signed-off-by: Zhen Lei > > This is inlined code so you are adding extra logic to every single > instance of a call

Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

2016-03-07 Thread One Thousand Gnomes
On Mon, 7 Mar 2016 17:21:25 +0800 Zhen Lei wrote: > Do this to keep consistent with kfree, which tolerate ptr is NULL. > > Signed-off-by: Zhen Lei This is inlined code so you are adding extra logic to every single instance of a call to the function. What is it's total effect on kernel size ?

Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

2016-03-07 Thread Leizhen (ThunderTown)
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