patch-2.3.28 linux/fs/proc/base.c

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

diff -u --recursive --new-file v2.3.27/linux/fs/proc/base.c linux/fs/proc/base.c
@@ -104,9 +104,12 @@
 {
 	struct mm_struct *mm = task->mm;
 	int res = 0;
-	if (mm)
-		res = access_process_vm(task, mm->env_start, buffer,
-					mm->env_end - mm->env_start, 0);
+	if (mm) {
+		int len = mm->env_end - mm->env_start;
+		if (len > PAGE_SIZE)
+			len = PAGE_SIZE;
+		res = access_process_vm(task, mm->env_start, buffer, len, 0);
+	}
 	return res;
 }
 
@@ -116,9 +119,12 @@
 {
 	struct mm_struct *mm = task->mm;
 	int res = 0;
-	if (mm)
-		res = access_process_vm(task, mm->arg_start, buffer,
-					mm->arg_end - mm->arg_start, 0);
+	if (mm) {
+		int len = mm->arg_end - mm->arg_start;
+		if (len > PAGE_SIZE)
+			len = PAGE_SIZE;
+		res = access_process_vm(task, mm->arg_start, buffer, len, 0);
+	}
 	return res;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)