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-352-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:18:11 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 351/437] s390: hw_random: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/char/hw_random/s390-trng.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/char/hw_random/s390-trng.c b/drivers/char/hw_random/s390-trng.c
index d27e32e9bfee..b1e1b896907c 100644
--- a/drivers/char/hw_random/s390-trng.c
+++ b/drivers/char/hw_random/s390-trng.c
@@ -53,9 +53,9 @@ static int trng_open(struct inode *inode, struct file *file)
 	return nonseekable_open(inode, file);
 }
 
-static ssize_t trng_read(struct file *file, char __user *ubuf,
-			 size_t nbytes, loff_t *ppos)
+static ssize_t trng_read(struct kiocb *iocb, struct iov_iter *to)
 {
+	size_t nbytes = iov_iter_count(to);
 	u8 buf[32];
 	u8 *p = buf;
 	unsigned int n;
@@ -85,12 +85,11 @@ static ssize_t trng_read(struct file *file, char __user *ubuf,
 		n = nbytes > PAGE_SIZE ? PAGE_SIZE : nbytes;
 		cpacf_trng(NULL, 0, p, n);
 		atomic64_add(n, &trng_dev_counter);
-		if (copy_to_user(ubuf, p, n)) {
+		if (!copy_to_iter_full(p, n, to)) {
 			ret = -EFAULT;
 			break;
 		}
 		nbytes -= n;
-		ubuf += n;
 		ret += n;
 	}
 
@@ -139,7 +138,7 @@ static const struct file_operations trng_fops = {
 	.owner		= THIS_MODULE,
 	.open		= &trng_open,
 	.release	= NULL,
-	.read		= &trng_read,
+	.read_iter	= trng_read,
 	.llseek		= noop_llseek,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ