Hi!

> I can (and will) test whatever patches is needed. Also will try to get rid of 
> uuid helpers and send a patch today.
> 

So ... here's patch that you can start from, and that may even work...

Thanks,
                                                                        Pavel

Signed-off-by: Pavel Machek <[email protected]>

diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c 
b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 1aa4a3f..a8e86cf 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -258,7 +258,17 @@ err:
 /* This function maps kernel space memory to user space memory. */
 static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-       u32 status;
+       int status;
+       struct omap_dsp_platform_data *pdata =
+           omap_dspbridge_dev->dev.platform_data;
+       unsigned long start = vma->vm_pgoff << PAGE_SHIFT;
+               
+       if (start < pdata->phys_mempool_base)
+               return -EINVAL;
+
+       if (vma->vm_end - vma->vm_start + (start - pdata->phys_mempool_base) 
+           > pdata->phys_mempool_size)
+               return -EINVAL;
 
        /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -271,10 +281,10 @@ static int bridge_mmap(struct file *filp, struct 
vm_area_struct *vma)
        status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
                                 vma->vm_end - vma->vm_start,
                                 vma->vm_page_prot);
-       if (status != 0)
-               status = -EAGAIN;
+       if (status)
+               return -EAGAIN;
 
-       return status;
+       return 0;
 }
 
 static const struct file_operations bridge_fops = {


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to