lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 Aug 2021 15:51:39 +0200
From:   Nuno Sá <noname.nuno@...il.com>
To:     Mihail Chindris <mihail.chindris@...log.com>,
        linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Cc:     lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
        nuno.sa@...log.com, dragos.bogdan@...log.com,
        alexandru.ardelean@...log.com
Subject: Re: [PATCH v4 2/6] iio: kfifo-buffer: Add output buffer support

On Fri, 2021-08-20 at 16:59 +0000, Mihail Chindris wrote:
> From: Lars-Peter Clausen <lars@...afoo.de>
> 
> Add output buffer support to the kfifo buffer implementation.
> 
> The implementation is straight forward and mostly just wraps the
> kfifo
> API to provide the required operations.
> 
> Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> Signed-off-by: Mihail Chindris <mihail.chindris@...log.com>
> ---
>  drivers/iio/buffer/kfifo_buf.c | 50
> ++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/drivers/iio/buffer/kfifo_buf.c
> b/drivers/iio/buffer/kfifo_buf.c
> index 516eb3465de1..7368db2d5c32 100644
> --- a/drivers/iio/buffer/kfifo_buf.c
> +++ b/drivers/iio/buffer/kfifo_buf.c
> @@ -138,10 +138,60 @@ static void iio_kfifo_buffer_release(struct
> iio_buffer *buffer)
>  	kfree(kf);
>  }
>  
> +static size_t iio_kfifo_buf_space_available(struct iio_buffer *r)
> +{
> +	struct iio_kfifo *kf = iio_to_kfifo(r);
> +	size_t avail;
> +
> +	mutex_lock(&kf->user_lock);
> +	avail = kfifo_avail(&kf->kf);
> +	mutex_unlock(&kf->user_lock);
> +
> +	return avail;
> +}
> +
> +static int iio_kfifo_remove_from(struct iio_buffer *r, void *data)
> +{
> +	int ret;
> +	struct iio_kfifo *kf = iio_to_kfifo(r);
> +
> +	if (kfifo_size(&kf->kf) < 1)
> +		return -EBUSY;
> +
> +	ret = kfifo_out(&kf->kf, data, 1);
> +	if (ret != 1)
> +		return -EBUSY;
> +
> +	wake_up_interruptible_poll(&r->pollq, POLLOUT | POLLWRNORM);
> +
> +	return 0;
> +}
> +
> +static int iio_kfifo_write(struct iio_buffer *r, size_t n,
> +	const char __user *buf)
> +{

nit: I would align this with the open parenthesis...

- Nuno Sá


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ