Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45f239ab authored by Newson Edouard's avatar Newson Edouard Committed by Mauro Carvalho Chehab
Browse files

[media] videobuf_pages_to_sg: sglist[0] length problem



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

Signed-off-by: default avatarNewson Edouard <newsondev@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4bbcd849
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -108,8 +108,9 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages,
	if (PageHighMem(pages[0]))
	if (PageHighMem(pages[0]))
		/* DMA to highmem pages might not work */
		/* DMA to highmem pages might not work */
		goto highmem;
		goto highmem;
	sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
	sg_set_page(&sglist[0], pages[0],
	size -= PAGE_SIZE - offset;
			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++) {
	for (i = 1; i < nr_pages; i++) {
		if (NULL == pages[i])
		if (NULL == pages[i])
			goto nopage;
			goto nopage;