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-72-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:13:31 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 071/437] dma-debug: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 kernel/dma/debug.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index a6e3792b15f8..4be49922129b 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -717,8 +717,7 @@ static void dma_entry_free(struct dma_debug_entry *entry)
  *   2. Preallocate a given number of dma_debug_entry structs
  */
 
-static ssize_t filter_read(struct file *file, char __user *user_buf,
-			   size_t count, loff_t *ppos)
+static ssize_t filter_read(struct kiocb *iocb, struct iov_iter *to)
 {
 	char buf[NAME_MAX_LEN + 1];
 	unsigned long flags;
@@ -736,12 +735,12 @@ static ssize_t filter_read(struct file *file, char __user *user_buf,
 	len = scnprintf(buf, NAME_MAX_LEN + 1, "%s\n", current_driver_name);
 	read_unlock_irqrestore(&driver_name_lock, flags);
 
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	return simple_copy_to_iter(buf, &iocb->ki_pos, len, to);
 }
 
-static ssize_t filter_write(struct file *file, const char __user *userbuf,
-			    size_t count, loff_t *ppos)
+static ssize_t filter_write(struct kiocb *iocb, struct iov_iter *from)
 {
+	size_t count = iov_iter_count(from);
 	char buf[NAME_MAX_LEN];
 	unsigned long flags;
 	size_t len;
@@ -754,7 +753,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
 	 * need to copy to temporary buffer first
 	 */
 	len = min(count, (size_t)(NAME_MAX_LEN - 1));
-	if (copy_from_user(buf, userbuf, len))
+	if (!copy_from_iter_full(buf, len, from))
 		return -EFAULT;
 
 	buf[len] = 0;
@@ -804,8 +803,8 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
 }
 
 static const struct file_operations filter_fops = {
-	.read  = filter_read,
-	.write = filter_write,
+	.read_iter  = filter_read,
+	.write_iter = filter_write,
 	.llseek = default_llseek,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ