Re: [RFC][PATCH 1/1] support for user-space buffers in kfifo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le mardi 12 juin 2007 à 11:24 -0500, Nelson Castillo a écrit :
> On 6/12/07, Stelian Pop <[email protected]> wrote:
> (cut)
> > accessing userspace memory with a spinlock taken (moreover an
> > irqsave()
> > one) is bad bad bad.
> 
> Hi Stelian.
> 
> I'm sending the new patch without kfifo_put_user and kfifo_get_user.

Ok, I have a few formatting/documentation comments:

> + * This function copies at most @len bytes from the @buffer into
> + * the FIFO depending on the free space, and returns the number of
> + * bytes copied.

... or -EFAULT if copy_from_user fails

> + *
> + * Note that with only one concurrent reader and one concurrent
> + * writer, you don't need extra locking to use these functions.
> + */
> +int __kfifo_put_user(struct kfifo *fifo, const unsigned char __user *buffer,
> +	        unsigned int len)

spacing ?

> +	if(copy_from_user(fifo->buffer + (fifo->in & (fifo->size - 1)),
> +			  buffer, l))

leave a space after the if please

> + * This function copies at most @len bytes from the FIFO into the
> + * @buffer and returns the number of copied bytes.

or -EFAULT

> + *
> + * Note that with only one concurrent reader and one concurrent
> + * writer, you don't need extra locking to use these functions.
> + */
> +
> +int __kfifo_get_user(struct kfifo *fifo,
> +			 unsigned char __user *buffer, unsigned int len)

spacing.

Other than that I'm ok with this patch.

Thanks,

Stelian.
-- 
Stelian Pop <[email protected]>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux