patch-2.1.92 linux/mm/vmalloc.c

Next file: linux/net/bridge/br.c
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.91/linux/mm/vmalloc.c linux/mm/vmalloc.c
@@ -208,11 +208,15 @@
 	return addr;
 }
 
-int vread(char *buf, char *addr, int count)
+long vread(char *buf, char *addr, unsigned long count)
 {
 	struct vm_struct **p, *tmp;
 	char *vaddr, *buf_start = buf;
 	int n;
+
+	/* Don't allow overflow */
+	if ((unsigned long) addr + count < count)
+		count = -(unsigned long) addr;
 
 	for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
 		vaddr = (char *) tmp->addr;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov