* [PATCH] proc_file_read fix for 2.5.68
@ 2003-04-25 13:32 Miklos Szeredi
0 siblings, 0 replies; only message in thread
From: Miklos Szeredi @ 2003-04-25 13:32 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds
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. 2.4.20 is OK in this respect.
Miklos
--- linux-2.5.68/fs/proc/generic.c~ 2003-03-05 04:29:55.000000000 +0100
+++ linux-2.5.68/fs/proc/generic.c 2003-04-25 15:00:02.000000000 +0200
@@ -136,11 +136,11 @@
"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) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-25 13:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-25 13:32 [PATCH] proc_file_read fix for 2.5.68 Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).