On Wed, 18 Oct 2000, Jeff Garzik wrote: > > Well coolio. Would somebody be up for sanity checking my audio mmap > code (attached)? It doesn't look too hard at all to get the audio > drivers doing the correct thing. Looks reasonable - although your "max_size" checks are wrong at mmap time. You should check for something like if (size > max_size) goto out; if (offset > max_size - size) goto out; instead of your current (offset >= max_size) check. As it stands, I think you can mmap past the end by just having size and offset < max_size, but the _sum_ being bigger.. > Since this code works in my local tests, my two concerns at this point > are correct vma->vm_pgoff treatment, and correct vm_flags/vm_file usage. You should drop the vma->vm_file = file; as the VM layer will have done that already. Also, the VM_LOCKED | VM_SHM thing is wrong, because it will cause mis-calulcation of the mm->vm_locked fields, and it's also unnecessary. Sure, it will cause the VM layer to not swap, but the no-op "swapping" shouldn't much hurt anyway, as it's easy enough to re-populate the page again. So either just drop it, or make sure that the locked page count doesn't get corrupted. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
- Re: mapping user space buffer to kernel address space Andrea Arcangeli
- Re: mapping user space buffer to kernel address space Stephen Tweedie
- Re: mapping user space buffer to kernel address space Linus Torvalds
- nopage() vs remap_page_range Justin Schoeman
- Re: mapping user space buffer to kernel address space Andrea Arcangeli
- Re: mapping user space buffer to kernel address space Linus Torvalds
- Re: mapping user space buffer to kernel address space Stephen Tweedie
- Re: mapping user space buffer to kernel address space Gerd Knorr
- Re: mapping user space buffer to kernel address space Jeff Garzik
- Re: mapping user space buffer to kernel address space Andrea Arcangeli
- Re: mapping user space buffer to kernel address space Linus Torvalds
- Re: mapping user space buffer to kernel address space Jeff Garzik
- Re: mapping user space buffer to kernel address space Linus Torvalds
- Re: mapping user space buffer to kernel address space Jeff Garzik
- Re: mapping user space buffer to kernel address space Andrea Arcangeli
- Re: mapping user space buffer to kernel address space Linus Torvalds
- VM_RESERVED [was Re: mapping user space buffer to kernel ... Andrea Arcangeli
- Re: VM_RESERVED [was Re: mapping user space buffer to ker... Linus Torvalds
- Re: VM_RESERVED [was Re: mapping user space buffer to ker... Andrea Arcangeli
- Re: VM_RESERVED [was Re: mapping user space buffer to ker... Linus Torvalds
- Re: VM_RESERVED [was Re: mapping user space buffer to ker... Andrea Arcangeli