From: Andrew Morton <akpm@linux-foundation.org>
To: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Will Deacon <will.deacon@arm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Zefan Li <lizefan@huawei.com>, Xinwei Hu <huxinwei@huawei.com>,
"Tianhong Ding" <dingtianhong@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>
Subject: Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL
Date: Mon, 7 Mar 2016 14:59:07 -0800 [thread overview]
Message-ID: <20160307145907.451d527dd34ad31424d841f6@linux-foundation.org> (raw)
In-Reply-To: <56DD5B63.9050609@huawei.com>
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.
next prev parent reply other threads:[~2016-03-07 22:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 9:21 Zhen Lei
2016-03-07 10:43 ` Leizhen (ThunderTown)
2016-03-07 22:59 ` Andrew Morton [this message]
2016-03-08 1:32 ` Leizhen (ThunderTown)
2016-03-07 11:41 ` One Thousand Gnomes
2016-03-07 12:22 ` Leizhen (ThunderTown)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160307145907.451d527dd34ad31424d841f6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dingtianhong@huawei.com \
--cc=guohanjun@huawei.com \
--cc=huxinwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=m.szyprowski@samsung.com \
--cc=thunder.leizhen@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®