patch-2.4.27 linux-2.4.27/fs/proc/base.c
Next file: linux-2.4.27/fs/proc/generic.c
Previous file: linux-2.4.27/fs/openpromfs/inode.c
Back to the patch index
Back to the overall index
- Lines: 38
- Date:
2004-08-07 16:26:06.014402660 -0700
- Orig file:
linux-2.4.26/fs/proc/base.c
- Orig date:
2003-11-28 10:26:21.000000000 -0800
diff -urN linux-2.4.26/fs/proc/base.c linux-2.4.27/fs/proc/base.c
@@ -337,6 +337,7 @@
ssize_t length;
ssize_t end;
struct task_struct *task = inode->u.proc_i.task;
+ loff_t pos = *ppos;
if (count > PROC_BLOCK_SIZE)
count = PROC_BLOCK_SIZE;
@@ -350,14 +351,14 @@
return length;
}
/* Static 4kB (or whatever) block capacity */
- if (*ppos >= length) {
+ if (pos < 0 || pos >= length) {
free_page(page);
return 0;
}
- if (count + *ppos > length)
- count = length - *ppos;
- end = count + *ppos;
- copy_to_user(buf, (char *) page + *ppos, count);
+ if (count > length - pos)
+ count = length - pos;
+ end = count + pos;
+ copy_to_user(buf, (char *) page + pos, count);
*ppos = end;
free_page(page);
return count;
@@ -883,8 +884,8 @@
return NULL;
out_unlock2:
- put_files_struct(files);
read_unlock(&files->file_lock);
+ put_files_struct(files);
out_unlock:
iput(inode);
out:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)