public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* proc_file_read() question
@ 2001-06-25 19:46 Martin Wilck
  2001-06-26  6:48 ` Mike Galbraith
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Wilck @ 2001-06-25 19:46 UTC (permalink / raw)
  To: Linux Kernel mailing list; +Cc: Paul.Russell


Hi,

the "hack" below in proc_file_read() fs/proc/generic.c (2.4.5)
irritates me:

If I do use "start" for a pointer into a memory area
allocated in read_proc, will it be always guaranteed
that (start > page)?

If no, this will IMO lead to spuriously wrong output.
If yes, I'd like to understand why.

Regards & thanks,
Martin

		/* 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 */

-- 
Martin Wilck     <Martin.Wilck@fujitsu-siemens.com>
FSC EP PS DS1, Paderborn      Tel. +49 5251 8 15113




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-06-27 21:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-25 19:46 proc_file_read() question Martin Wilck
2001-06-26  6:48 ` Mike Galbraith
2001-06-26 17:14   ` [PATCH] proc_file_read() (Was: Re: proc_file_read() question) Martin Wilck
2001-06-26 17:54     ` Jonathan Lundell
2001-06-27  8:07       ` Martin Wilck
2001-06-27 15:54         ` Jonathan Lundell
2001-06-27 17:56           ` Martin Wilck
2001-06-27 21:32             ` Roman Zippel
2001-06-26 20:35     ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox