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-66-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:13:25 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 065/437] SoC: SOF: icp4: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 sound/soc/sof/ipc4-mtrace.c    | 17 +++++++++--------
 sound/soc/sof/ipc4-telemetry.c | 14 +++++++-------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c
index 0e04bea9432d..976951a486b5 100644
--- a/sound/soc/sof/ipc4-mtrace.c
+++ b/sound/soc/sof/ipc4-mtrace.c
@@ -274,6 +274,7 @@ static ssize_t sof_ipc4_mtrace_dfs_read(struct file *file, char __user *buffer,
 
 	return count;
 }
+FOPS_READ_ITER_HELPER(sof_ipc4_mtrace_dfs_read);
 
 static int sof_ipc4_mtrace_dfs_release(struct inode *inode, struct file *file)
 {
@@ -291,17 +292,17 @@ static int sof_ipc4_mtrace_dfs_release(struct inode *inode, struct file *file)
 
 static const struct file_operations sof_dfs_mtrace_fops = {
 	.open = sof_ipc4_mtrace_dfs_open,
-	.read = sof_ipc4_mtrace_dfs_read,
+	.read_iter = sof_ipc4_mtrace_dfs_read_iter,
 	.llseek = default_llseek,
 	.release = sof_ipc4_mtrace_dfs_release,
 
 	.owner = THIS_MODULE,
 };
 
-static ssize_t sof_ipc4_priority_mask_dfs_read(struct file *file, char __user *to,
-					       size_t count, loff_t *ppos)
+static ssize_t sof_ipc4_priority_mask_dfs_read(struct kiocb *iocb,
+					       struct iov_iter *to)
 {
-	struct sof_mtrace_priv *priv = file->private_data;
+	struct sof_mtrace_priv *priv = iocb->ki_filp->private_data;
 	int i, ret, offset, remaining;
 	char *buf;
 
@@ -322,8 +323,7 @@ static ssize_t sof_ipc4_priority_mask_dfs_read(struct file *file, char __user *t
 			 priv->state_info.logs_priorities_mask[i]);
 	}
 
-	ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf));
-
+	ret = simple_copy_to_iter(buf, &iocb->ki_pos, strlen(buf), to);
 	kfree(buf);
 	return ret;
 }
@@ -368,11 +368,12 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
 	kfree(buf);
 	return ret;
 }
+FOPS_WRITE_ITER_HELPER(sof_ipc4_priority_mask_dfs_write);
 
 static const struct file_operations sof_dfs_priority_mask_fops = {
 	.open = simple_open,
-	.read = sof_ipc4_priority_mask_dfs_read,
-	.write = sof_ipc4_priority_mask_dfs_write,
+	.read_iter = sof_ipc4_priority_mask_dfs_read,
+	.write_iter = sof_ipc4_priority_mask_dfs_write_iter,
 	.llseek = default_llseek,
 
 	.owner = THIS_MODULE,
diff --git a/sound/soc/sof/ipc4-telemetry.c b/sound/soc/sof/ipc4-telemetry.c
index ec4ae9674364..8b4ef6ae8753 100644
--- a/sound/soc/sof/ipc4-telemetry.c
+++ b/sound/soc/sof/ipc4-telemetry.c
@@ -32,13 +32,13 @@ static void __iomem *sof_ipc4_query_exception_address(struct snd_sof_dev *sdev)
 	return sdev->bar[sdev->mailbox_bar] + offset;
 }
 
-static ssize_t sof_telemetry_entry_read(struct file *file, char __user *buffer,
-					size_t count, loff_t *ppos)
+static ssize_t sof_telemetry_entry_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct snd_sof_dfsentry *dfse = file->private_data;
+	struct snd_sof_dfsentry *dfse = iocb->ki_filp->private_data;
 	struct snd_sof_dev *sdev = dfse->sdev;
+	size_t count = iov_iter_count(to);
 	void __iomem *io_addr;
-	loff_t pos = *ppos;
+	loff_t pos = iocb->ki_pos;
 	size_t size_ret;
 	u8 *buf;
 
@@ -59,13 +59,13 @@ static ssize_t sof_telemetry_entry_read(struct file *file, char __user *buffer,
 		return -ENOMEM;
 
 	memcpy_fromio(buf, io_addr, SOF_IPC4_DEBUG_SLOT_SIZE - 4);
-	size_ret = copy_to_user(buffer, buf + pos, count);
+	size_ret = !copy_to_iter_full(buf + pos, count, to);
 	if (size_ret) {
 		kfree(buf);
 		return -EFAULT;
 	}
 
-	*ppos = pos + count;
+	iocb->ki_pos = pos + count;
 	kfree(buf);
 
 	return count;
@@ -73,7 +73,7 @@ static ssize_t sof_telemetry_entry_read(struct file *file, char __user *buffer,
 
 static const struct file_operations sof_telemetry_fops = {
 	.open = simple_open,
-	.read = sof_telemetry_entry_read,
+	.read_iter = sof_telemetry_entry_read,
 };
 
 void sof_ipc4_create_exception_debugfs_node(struct snd_sof_dev *sdev)
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ