Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352061

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

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL
Date 2016-03-08 00:00 +0100
Message-ID <raci8-C6-73@gated-at.bofh.it> (permalink)
References <r9ZEe-Y3-13@gated-at.bofh.it> <ra0TE-1Io-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL Zhen Lei <thunder.leizhen@huawei.com> - 2016-03-07 10:30 +0100
  Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-07 11:50 +0100
    Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is  NULL Andrew Morton <akpm@linux-foundation.org> - 2016-03-08 00:00 +0100
      Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-08 02:40 +0100
  Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is  NULL One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-03-07 12:50 +0100
    Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-07 13:30 +0100

csiph-web