patch-1.3.22 linux/fs/proc/array.c

Next file: linux/fs/proc/inode.c
Previous file: linux/fs/open.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.21/linux/fs/proc/array.c linux/fs/proc/array.c
@@ -56,7 +56,7 @@
 
 static int read_core(struct inode * inode, struct file * file,char * buf, int count)
 {
-	unsigned long p = file->f_pos;
+	unsigned long p = file->f_pos, memsize;
 	int read;
 	int count1;
 	char * pnt;
@@ -64,14 +64,15 @@
 
 	memset(&dump, 0, sizeof(struct user));
 	dump.magic = CMAGIC;
-	dump.u_dsize = high_memory >> 12;
+	dump.u_dsize = MAP_NR(high_memory);
 
 	if (count < 0)
 		return -EINVAL;
-	if (p >= high_memory + PAGE_SIZE)
+	memsize = MAP_NR(high_memory + PAGE_SIZE) << PAGE_SHIFT;
+	if (p >= memsize)
 		return 0;
-	if (count > high_memory + PAGE_SIZE - p)
-		count = high_memory + PAGE_SIZE - p;
+	if (count > memsize - p)
+		count = memsize - p;
 	read = 0;
 
 	if (p < sizeof(struct user) && count > 0) {
@@ -93,7 +94,7 @@
 		count--;
 		read++;
 	}
-	memcpy_tofs(buf,(void *) (p - PAGE_SIZE),count);
+	memcpy_tofs(buf,(void *) (PAGE_OFFSET + p - PAGE_SIZE),count);
 	read += count;
 	file->f_pos += read;
 	return read;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this