All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] videobuf_pages_to_sg: sglist[0] length problem
@ 2011-04-19 14:54 Newson Edouard
  0 siblings, 0 replies; only message in thread
From: Newson Edouard @ 2011-04-19 14:54 UTC (permalink / raw)
  To: linux-media

On function videobuf_pages_to_sg the statement sg_set_page(&sglist[0],
pages[0], PAGE_SIZE -
offset, offset) will failed if if size is less than PAGE_SIZE.

Signed-off-by: Newson Edouard <newsondev@gmail.com

---
 drivers/media/video/videobuf-dma-sg.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/videobuf-dma-sg.c
b/drivers/media/video/videobuf-dma-sg.c
index ddb8f4b..f300dea 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -108,8 +108,9 @@ static struct scatterlist
*videobuf_pages_to_sg(struct page **pages,
 	if (PageHighMem(pages[0]))
 		/* DMA to highmem pages might not work */
 		goto highmem;
-	sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
-	size -= PAGE_SIZE - offset;
+	sg_set_page(&sglist[0], pages[0],
+			min_t(size_t, PAGE_SIZE - offset, size), offset);
+	size -= min_t(size_t, PAGE_SIZE - offset, size);
 	for (i = 1; i < nr_pages; i++) {
 		if (NULL == pages[i])
 			goto nopage;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-19 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 14:54 [PATCH] videobuf_pages_to_sg: sglist[0] length problem Newson Edouard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.