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]
Message-ID: <20240411153126.16201-431-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:30 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 430/437] sbus: flash: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/sbus/char/flash.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 05d37d31c3b8..4b21dc0cb3c4 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -98,11 +98,10 @@ flash_llseek(struct file *file, long long offset, int origin)
 	return file->f_pos;
 }
 
-static ssize_t
-flash_read(struct file * file, char __user * buf,
-	   size_t count, loff_t *ppos)
+static ssize_t flash_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	loff_t p = *ppos;
+	size_t count = iov_iter_count(to);
+	loff_t p = iocb->ki_pos;
 	int i;
 
 	if (count > flash.read_size - p)
@@ -110,12 +109,11 @@ flash_read(struct file * file, char __user * buf,
 
 	for (i = 0; i < count; i++) {
 		u8 data = upa_readb(flash.read_base + p + i);
-		if (put_user(data, buf))
+		if (put_iter(data, to))
 			return -EFAULT;
-		buf++;
 	}
 
-	*ppos += count;
+	iocb->ki_pos += count;
 	return count;
 }
 
@@ -148,7 +146,7 @@ static const struct file_operations flash_fops = {
 	 */
 	.owner =	THIS_MODULE,
 	.llseek =	flash_llseek,
-	.read =		flash_read,
+	.read_iter =	flash_read,
 	.mmap =		flash_mmap,
 	.open =		flash_open,
 	.release =	flash_release,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ