From: Andreas Schwab <schwab@suse.de>
To: Thomas Hood <jdthood@mail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: proc_file_read bug?
Date: Fri, 25 Jan 2002 15:29:35 +0100 [thread overview]
Message-ID: <jer8oesdv4.fsf@sykes.suse.de> (raw)
In-Reply-To: <1011965794.1338.6.camel@thanatos>
In-Reply-To: <1011965794.1338.6.camel@thanatos> (Thomas Hood's message of "25 Jan 2002 08:36:32 -0500")
Thomas Hood <jdthood@mail.com> writes:
|> I don't understand this part of proc_file_read() in
|> fs/proc/generic.c:
|>
|> /* This is a hack to allow mangling of file pos independent
|> * of actual bytes read. Simply place the data at page,
|> * return the bytes, and set `start' to the desired offset
|> * as an unsigned int. - Paul.Russell@rustcorp.com.au
|> */
|> n -= copy_to_user(buf, start < page ? page : start, n);
|> if (n == 0) {
|> if (retval == 0)
|> retval = -EFAULT;
|> break;
|> }
|>
|> *ppos += start < page ? (long)start : n; /* Move down the file */
|> nbytes -= n;
|> buf += n;
|> retval += n;
|>
|> When start >= page, we copy n bytes beginning at start and
|> increase *ppos by n. Makes sense. But what happens when
|> start < page? We will copy n bytes starting at page, then
|> increase *ppos by start!! What sense does that make? If
|> there's cleverness happening here, someone please document it.
It is documented, RTFC.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2002-01-25 14:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-25 13:36 proc_file_read bug? Thomas Hood
2002-01-25 14:29 ` Andreas Schwab [this message]
2002-01-25 15:00 ` Thomas Hood
-- strict thread matches above, loose matches on Subject: below --
2002-01-27 0:19 Thomas Hood
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=jer8oesdv4.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=jdthood@mail.com \
--cc=linux-kernel@vger.kernel.org \
/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