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-404-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:03 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Krzysztof Kanas <kkanas@...tmail.com>,
	Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 403/437] drivers/media/platform/mediatek/vcodec: convert to read/write iterators

From: Krzysztof Kanas <kkanas@...tmail.com>

Signed-off-by: Krzysztof Kanas <kkanas@...tmail.com>
[axboe: fold in patch for killing FOPS helpers]
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 .../mediatek/vcodec/common/mtk_vcodec_dbgfs.c | 21 +++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c
index 5ad3797836db..b8e4779b32d2 100644
--- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c
+++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c
@@ -70,15 +70,15 @@ static void mtk_vdec_dbgfs_get_help(char *buf, int *used, int total)
 	*used += curr_len;
 }
 
-static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
-				    size_t count, loff_t *ppos)
+static ssize_t mtk_vdec_dbgfs_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct mtk_vcodec_dec_dev *vcodec_dev = filp->private_data;
+	struct mtk_vcodec_dec_dev *vcodec_dev = iocb->ki_filp->private_data;
 	struct mtk_vcodec_dbgfs *dbgfs = &vcodec_dev->dbgfs;
+	size_t count = iov_iter_count(from);
 
 	mutex_lock(&dbgfs->dbgfs_lock);
-	dbgfs->buf_size = simple_write_to_buffer(dbgfs->dbgfs_buf, sizeof(dbgfs->dbgfs_buf),
-						 ppos, ubuf, count);
+	dbgfs->buf_size = simple_copy_to_iter(dbgfs->dbgfs_buf, &iocb->ki_pos,
+						sizeof(dbgfs->dbgfs_buf), from);
 	mutex_unlock(&dbgfs->dbgfs_lock);
 	if (dbgfs->buf_size > 0)
 		return count;
@@ -86,10 +86,9 @@ static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
 	return dbgfs->buf_size;
 }
 
-static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
-				   size_t count, loff_t *ppos)
+static ssize_t mtk_vdec_dbgfs_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct mtk_vcodec_dec_dev *vcodec_dev = filp->private_data;
+	struct mtk_vcodec_dec_dev *vcodec_dev = iocb->ki_filp->private_data;
 	struct mtk_vcodec_dbgfs *dbgfs = &vcodec_dev->dbgfs;
 	struct mtk_vcodec_dbgfs_inst *dbgfs_inst;
 	struct mtk_vcodec_dec_ctx *ctx;
@@ -133,15 +132,15 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
 	}
 	mutex_unlock(&dbgfs->dbgfs_lock);
 read_buffer:
-	ret = simple_read_from_buffer(ubuf, count, ppos, buf, used_len);
+	ret = simple_copy_to_iter(buf, &iocb->ki_pos, used_len, to);
 	kfree(buf);
 	return ret;
 }
 
 static const struct file_operations vdec_fops = {
 	.open = simple_open,
-	.write = mtk_vdec_dbgfs_write,
-	.read = mtk_vdec_dbgfs_read,
+	.write_iter = mtk_vdec_dbgfs_write,
+	.read_iter = mtk_vdec_dbgfs_read,
 };
 
 void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx)
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ