patch "iio: buffer: correctly return bytes written in output buffers" added to char-misc-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
iio: buffer: correctly return bytes written in output buffers
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From b5184a26a28fac1d708b0bfeeb958a9260c2924c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nuno=20S=C3=A1?= <[email protected]>
Date: Thu, 16 Feb 2023 11:14:50 +0100
Subject: iio: buffer: correctly return bytes written in output buffers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If for some reason 'rb->access->write()' does not write the full requested data and the O_NONBLOCK is set, we would return 'n' to userspace which is not really truth. Hence, let's return the number of bytes we effectively wrote.
--- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +1 -1
@@ -220,7 +220,7 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf, }while (ret ==0 );remove_wait_queue (&rb->pollq, &wait); -return ret <0 ? ret : n; +return ret <0 ? ret : written; }/**
Signature · 1 line
2.40.0