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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 sound/soc/soc-dapm.c | 21 ++++++++-------------
 sound/soc/soc-pcm.c  | 10 ++++------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index ad8ba8fbbaee..f3cfbf70f8a4 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2094,11 +2094,9 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 }
 
 #ifdef CONFIG_DEBUG_FS
-static ssize_t dapm_widget_power_read_file(struct file *file,
-					   char __user *user_buf,
-					   size_t count, loff_t *ppos)
+static ssize_t dapm_widget_power_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct snd_soc_dapm_widget *w = file->private_data;
+	struct snd_soc_dapm_widget *w = iocb->ki_filp->private_data;
 	enum snd_soc_dapm_direction dir, rdir;
 	char *buf;
 	int in, out;
@@ -2155,22 +2153,20 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
 
 	snd_soc_dapm_mutex_unlock(w->dapm);
 
-	ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
-
+	ret = simple_copy_to_iter(buf, &iocb->ki_pos, ret, to);
 	kfree(buf);
 	return ret;
 }
 
 static const struct file_operations dapm_widget_power_fops = {
 	.open = simple_open,
-	.read = dapm_widget_power_read_file,
+	.read_iter = dapm_widget_power_read,
 	.llseek = default_llseek,
 };
 
-static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
-				   size_t count, loff_t *ppos)
+static ssize_t dapm_bias_read_file(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct snd_soc_dapm_context *dapm = file->private_data;
+	struct snd_soc_dapm_context *dapm = iocb->ki_filp->private_data;
 	char *level;
 
 	switch (dapm->bias_level) {
@@ -2192,13 +2188,12 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
 		break;
 	}
 
-	return simple_read_from_buffer(user_buf, count, ppos, level,
-				       strlen(level));
+	return simple_copy_to_iter(level, &iocb->ki_pos, strlen(level), to);
 }
 
 static const struct file_operations dapm_bias_fops = {
 	.open = simple_open,
-	.read = dapm_bias_read_file,
+	.read_iter = dapm_bias_read_file,
 	.llseek = default_llseek,
 };
 
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 77ee103b7cd1..611845526491 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -164,10 +164,9 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
 	return offset;
 }
 
-static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
-				    size_t count, loff_t *ppos)
+static ssize_t dpcm_state_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct snd_soc_pcm_runtime *fe = file->private_data;
+	struct snd_soc_pcm_runtime *fe = iocb->ki_filp->private_data;
 	ssize_t out_count = PAGE_SIZE, offset = 0, ret = 0;
 	int stream;
 	char *buf;
@@ -190,15 +189,14 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
 						  out_count - offset);
 	snd_soc_dpcm_mutex_unlock(fe);
 
-	ret = simple_read_from_buffer(user_buf, count, ppos, buf, offset);
-
+	ret = simple_copy_to_iter(buf, &iocb->ki_pos, offset, to);
 	kfree(buf);
 	return ret;
 }
 
 static const struct file_operations dpcm_state_fops = {
 	.open = simple_open,
-	.read = dpcm_state_read_file,
+	.read_iter = dpcm_state_read,
 	.llseek = default_llseek,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ