Skip to contentSkip to conversation

- UML - iomem fix

PATCH New Jeff Dike 1 participant 1 message Sep 14, 2004 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/1 - UML - iomem fix

This patch rounds up the size of a file used for iomem emulation up to the nearest page. This makes mmap work much better on the last page of the file.

arch/um/kernel/mem_user.c +4 -2
Index: 2.6.9-rc2/arch/um/kernel/mem_user.c
===================================================================
@@ -143,7 +143,7 @@
 	struct iomem_region *new;
 	struct uml_stat buf;
 	char *file, *driver;
-	int fd, err;
+	int fd, err, size;
 
 	driver = str;
 	file = strchr(str,',');
@@ -171,10 +171,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;