From patchwork Tue Dec 8 21:36:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 65806 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB8LchMD025047 for ; Tue, 8 Dec 2009 21:38:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756334AbZLHVhA (ORCPT ); Tue, 8 Dec 2009 16:37:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965711AbZLHVhA (ORCPT ); Tue, 8 Dec 2009 16:37:00 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:51933 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756297AbZLHVgy (ORCPT ); Tue, 8 Dec 2009 16:36:54 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id nB8LaxAV018485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Dec 2009 15:36:59 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id nB8LaxnK002478; Tue, 8 Dec 2009 15:36:59 -0600 (CST) Received: from gt516km11.gt.design.ti.com (gt516km11.gt.design.ti.com [158.218.100.179]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id nB8LawZ12728; Tue, 8 Dec 2009 15:36:58 -0600 (CST) Received: from gt516km11.gt.design.ti.com (localhost.localdomain [127.0.0.1]) by gt516km11.gt.design.ti.com (8.13.1/8.13.1) with ESMTP id nB8Lawic022897; Tue, 8 Dec 2009 16:36:58 -0500 Received: (from a0868495@localhost) by gt516km11.gt.design.ti.com (8.13.1/8.13.1/Submit) id nB8LaviL022894; Tue, 8 Dec 2009 16:36:57 -0500 From: m-karicheri2@ti.com To: linux-media@vger.kernel.org, magnus.damm@gmail.com Cc: Muralidharan Karicheri Subject: [PATCH - v1] V4L-Fix videobuf_dma_contig_user_get() for non-aligned offsets Date: Tue, 8 Dec 2009 16:36:57 -0500 Message-Id: <1260308217-22871-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.6.0.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index d25f284..22c0109 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;