It is possible that do_mmap succeeds, but uvaddr does not indicate a valid place to store the result. To make sure of this, do something like:
void *mmap_result; printk(KERN_DEBUG "uvaddr = %p", uvaddr); mmap_result = (void *)do_mmap(0, 0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, 0); printk(KERN_DEBUG "mmap_result = %p", mmap_result); *uvaddr = mmap_result;
This should tell you for sure what fails: calling do_mmap or assigning *uvaddr .
source share