[PATCH] RTAS syscall - review request

linas at austin.ibm.com linas at austin.ibm.com
Tue Nov 25 09:16:46 EST 2003


On Mon, Nov 10, 2003 at 11:51:21AM -0600, John Rose wrote:
>
> This patch implements a generic RTAS interface to userspace through a
> system call.  It was originally written by Rusty Russel and modified by
> myself.  There are two main parts:
....

In the patch below, someone mentioned the need for using
copy_to_user() in the /proc routines.  But I couldn't help
noticing that much of the existing code ppc64 *proc*.c code
doesn't use copy_to_user.  (at least not in the 2.4 tree)
(well, at least ppc_rtas_tone_volume_read() doesn't and I
thought I saw more).

--linas

> diff -Nru a/arch/ppc64/kernel/rtas-proc.c b/arch/ppc64/kernel/rtas-proc.c
> --- a/arch/ppc64/kernel/rtas-proc.c	Mon Nov 10 11:34:58 2003
> +++ b/arch/ppc64/kernel/rtas-proc.c	Mon Nov 10 11:34:58 2003
> @@ -842,6 +851,23 @@
>  	int n;
>  	n = sprintf(buf, "%lu\n", rtas_tone_volume);
>
> +	if (*ppos >= strlen(buf))
> +		return 0;
> +	if (n > strlen(buf) - *ppos)
> +		n = strlen(buf) - *ppos;
> +	if (n > count)
> +		n = count;
> +	*ppos += n;
> +	return n;
> +}
> +
> +/* RTAS Userspace access */
> +static ssize_t ppc_rtas_rmo_buf_read(struct file *file, char *buf,
> +				    size_t count, loff_t *ppos)
> +{
> +	int n;
> +
> +	n = sprintf(buf, "%p %x\n", rtas_rmo_buf, RTAS_SYSCALL_MAX);
>  	if (*ppos >= strlen(buf))
>  		return 0;
>  	if (n > strlen(buf) - *ppos)

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list