summaryrefslogtreecommitdiff
path: root/drivers/media/common/videobuf2/videobuf2-vmalloc.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2018-02-06 03:02:23 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-02-26 08:06:31 -0500
commitd13a0139d7874a0577b5955d6eed895517d23b72 (patch)
treebea9ec23c8fef71f4118c2b6fca465c66259ef1d /drivers/media/common/videobuf2/videobuf2-vmalloc.c
parent14351d44830ec00b8c66b44c8c866944da678c33 (diff)
media: vb2: Fix videobuf2 to map correct area
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@kernel.org> Reported-by: Takao Orito <orito.takao@socionext.com> Reported-by: Fumihiro ATSUMI <atsumi@infinitegra.co.jp> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-vmalloc.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-vmalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
index 3a7c80cd1a17..359fb9804d16 100644
--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
+++ b/drivers/media/common/videobuf2/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);