lkml.org 
[lkml]   [2003]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] proc_file_read fix for 2.5.68

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) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.072 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site