[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160307145907.451d527dd34ad31424d841f6@linux-foundation.org>
Date: Mon, 7 Mar 2016 14:59:07 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Will Deacon <will.deacon@....com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Zefan Li <lizefan@...wei.com>, Xinwei Hu <huxinwei@...wei.com>,
"Tianhong Ding" <dingtianhong@...wei.com>,
Hanjun Guo <guohanjun@...wei.com>
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@...wei.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.
Powered by blists - more mailing lists