Return-path: Received: from ch1ehsobe001.messaging.microsoft.com ([216.32.181.181]:46821 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373Ab2IMClI (ORCPT ); Wed, 12 Sep 2012 22:41:08 -0400 From: Bob Liu To: CC: , , , , , , , , , , Bob Liu Subject: [PATCH] nommu: remap_pfn_range: fix addr parameter check Date: Thu, 13 Sep 2012 10:40:57 +0800 Message-ID: <1347504057-5612-1-git-send-email-lliubbo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-media-owner@vger.kernel.org List-ID: The addr parameter may not page aligned eg. when it's come from vfb_mmap():vma->vm_start in video driver. This patch fix the check in remap_pfn_range() else some driver like v4l2 will fail in this function while calling mmap() on nommu arch like blackfin and st. Reported-by: Bhupesh SHARMA Reported-by: Scott Jiang Signed-off-by: Bob Liu --- mm/nommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/nommu.c b/mm/nommu.c index d4b0c10..5d6068b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1819,7 +1819,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, unsigned long size, pgprot_t prot) { - if (addr != (pfn << PAGE_SHIFT)) + if ((addr & PAGE_MASK) != (pfn << PAGE_SHIFT)) return -EINVAL; vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; -- 1.7.9.5