[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <cd355844-89d0-b49a-0244-c0e45fc68724@samsung.com>
Date: Tue, 06 Feb 2018 09:13:30 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Masami Hiramatsu <mhiramat@...nel.org>,
Pawel Osciak <pawel@...iak.com>,
Kyungmin Park <kyungmin.park@...sung.com>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
orito.takao@...ionext.com,
Fumihiro ATSUMI <atsumi@...initegra.co.jp>
Subject: Re: [PATCH v2] media: vb2: Fix videobuf2 to map correct area
Hi Masami,
On 2018-02-06 09:02, Masami Hiramatsu wrote:
> Fixes vb2_vmalloc_get_userptr() to ioremap correct area.
> Since the current code does ioremap the page address, if the offset > 0,
> it does not do ioremap the last page and results in kernel panic.
>
> This fixes to pass the size + offset to ioremap so that ioremap
> can map correct area. Also, this uses __pfn_to_phys() to get the physical
> address of given PFN.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> Reported-by: Takao Orito <orito.takao@...ionext.com>
> Reported-by: Fumihiro ATSUMI <atsumi@...initegra.co.jp>
Reviewed-by: Marek Szyprowski <m.szyprowski@...sung.com>
> ---
> Chanegs in v2:
> - Fix to pass size + offset instead of changing address.
> ---
> drivers/media/v4l2-core/videobuf2-vmalloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c
> index 3a7c80cd1a17..359fb9804d16 100644
> --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
> +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
> @@ -106,7 +106,7 @@ static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr,
> if (nums[i-1] + 1 != nums[i])
> goto fail_map;
> buf->vaddr = (__force void *)
> - ioremap_nocache(nums[0] << PAGE_SHIFT, size);
> + ioremap_nocache(__pfn_to_phys(nums[0]), size + offset);
> } else {
> buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1,
> PAGE_KERNEL);
>
>
>
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Powered by blists - more mailing lists