diff options
author | Muralidharan Karicheri <m-karicheri2@ti.com> | 2009-12-10 20:47:48 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-16 03:18:34 +0100 |
commit | 31bedfa5068936b15a388842be1d03cdd1bdfb07 (patch) | |
tree | d02d9204a0ed1fe2a9eca8b7f2d1553b1d85d5a3 /drivers | |
parent | V4L/DVB (13597): bttv: add i2c addr for old WinTV card to IR probe list (diff) | |
download | linux-31bedfa5068936b15a388842be1d03cdd1bdfb07.tar.xz linux-31bedfa5068936b15a388842be1d03cdd1bdfb07.zip |
V4L/DVB (13598): videobuf_dma_contig_user_get() for non-aligned offsets
If a USERPTR address that is not aligned to page boundary is passed to the
videobuf_dma_contig_user_get() function, it saves a page aligned address to
the dma_handle. This is not correct. This issue is observed when using USERPTR
IO machism for buffer exchange.
Updates from last version:-
Adding offset for size calculation as per comment from Magnus Damm. This
ensures the last page is also included for checking if memory is
contiguous.
Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/videobuf-dma-contig.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index d25f28461da1..22c01097e8a8 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c @@ -141,9 +141,11 @@ static int videobuf_dma_contig_user_get(struct videobuf_dma_contig_memory *mem, struct vm_area_struct *vma; unsigned long prev_pfn, this_pfn; unsigned long pages_done, user_address; + unsigned int offset; int ret; - mem->size = PAGE_ALIGN(vb->size); + offset = vb->baddr & ~PAGE_MASK; + mem->size = PAGE_ALIGN(vb->size + offset); mem->is_userptr = 0; ret = -EINVAL; @@ -166,7 +168,7 @@ static int videobuf_dma_contig_user_get(struct videobuf_dma_contig_memory *mem, break; if (pages_done == 0) - mem->dma_handle = this_pfn << PAGE_SHIFT; + mem->dma_handle = (this_pfn << PAGE_SHIFT) + offset; else if (this_pfn != (prev_pfn + 1)) ret = -EFAULT; |