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. Signed-off-by: Paolo 'Blaisorblade' Giarrusso --- um-linux-2.4.27-paolo/arch/um/kernel/mem_user.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff -puN arch/um/kernel/mem_user.c~iomem arch/um/kernel/mem_user.c --- um-linux-2.4.27/arch/um/kernel/mem_user.c~iomem 2005-04-15 11:12:53.000000000 +0200 +++ um-linux-2.4.27-paolo/arch/um/kernel/mem_user.c 2005-04-15 11:12:53.000000000 +0200 @@ -141,7 +141,7 @@ static int __init parse_iomem(char *str, 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 @@ static int __init parse_iomem(char *str, 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; _