# This fixes a bug spotted by the iomem tester in the test suite. mmapper # returns -EFAULT if the mmap length is greater than the iomem region size. # If that size is less than one page, then mmap can never succeed because # the minimum map length is one page. This fixes that by rounding the iomem # file size up to the nearest page. Index: um/arch/um/kernel/mem_user.c =================================================================== --- um.orig/arch/um/kernel/mem_user.c 2004-07-23 19:32:13.000000000 -0400 +++ um/arch/um/kernel/mem_user.c 2004-07-23 19:36:35.000000000 -0400 @@ -141,7 +141,7 @@ struct iomem_region *new; struct uml_stat buf; char *file, *driver; - int fd, err; + int fd, err, size; driver = str; file = strchr(str,','); @@ -169,10 +169,12 @@ goto out_close; } + size = (buf.ust_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1); + *new = ((struct iomem_region) { .next = iomem_regions, .driver = driver, .fd = fd, - .size = buf.ust_size, + .size = size, .phys = 0, .virt = 0 }); iomem_regions = new;