linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos.Szeredi@eth.ericsson.se (Miklos Szeredi)
To: linux-kernel@vger.kernel.org
Cc: torvalds@transmeta.com
Subject: [PATCH] proc_file_read fix for 2.5.68
Date: Fri, 25 Apr 2003 15:32:00 +0200 (MEST)	[thread overview]
Message-ID: <200304251332.h3PDW0f22620@duna48.eth.ericsson.se> (raw)


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) {

                 reply	other threads:[~2003-04-25 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200304251332.h3PDW0f22620@duna48.eth.ericsson.se \
    --to=miklos.szeredi@eth.ericsson.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).