From: Miklos.Szeredi@eth.ericsson.se (Miklos Szeredi) This fixes a problem with method 0 of proc_file_read (when the whole file is copied to the page). The calculation of the final bytecount is wrong, and hence smaller then page size reads will give a truncated file. Current 2.4 kernels do it this way as well. 25-akpm/fs/proc/generic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN fs/proc/generic.c~proc_file_read-fix fs/proc/generic.c --- 25/fs/proc/generic.c~proc_file_read-fix Fri Apr 25 15:46:19 2003 +++ 25-akpm/fs/proc/generic.c Fri Apr 25 15:46:19 2003 @@ -136,11 +136,11 @@ proc_file_read(struct file * file, char "proc_file_read: Apparent buffer overflow!\n"); n = PAGE_SIZE; } - if (n > count) - n = count; n -= *ppos; if (n <= 0) break; + if (n > count) + n = count; start = page + *ppos; } else if (start < page) { if (n > PAGE_SIZE) { _