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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/block/mtip32xx/mtip32xx.c | 36 +++++++++++++++----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 43a187609ef7..28ea499cbbfd 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2162,13 +2162,13 @@ static const struct attribute_group *mtip_disk_attr_groups[] = {
 	NULL,
 };
 
-static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
-				  size_t len, loff_t *offset)
+static ssize_t mtip_hw_read_registers(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct driver_data *dd =  (struct driver_data *)f->private_data;
+	struct driver_data *dd =  iocb->ki_filp->private_data;
+	size_t len = iov_iter_count(to);
 	char *buf;
 	u32 group_allocated;
-	int size = *offset;
+	int size = iocb->ki_pos;
 	int n, rv = 0;
 
 	if (!len || size)
@@ -2217,21 +2217,21 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
 	}
 	size += sprintf(&buf[size], "]\n");
 
-	*offset = size <= len ? size : len;
-	size = copy_to_user(ubuf, buf, *offset);
-	if (size)
+	iocb->ki_pos = size <= len ? size : len;
+	size = copy_to_iter(buf, iocb->ki_pos, to);
+	if (!size)
 		rv = -EFAULT;
 
 	kfree(buf);
-	return rv ? rv : *offset;
+	return rv ? rv : iocb->ki_pos;
 }
 
-static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
-				  size_t len, loff_t *offset)
+static ssize_t mtip_hw_read_flags(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct driver_data *dd =  (struct driver_data *)f->private_data;
+	struct driver_data *dd =  iocb->ki_filp->private_data;
+	size_t len = iov_iter_count(to);
 	char *buf;
-	int size = *offset;
+	int size = iocb->ki_pos;
 	int rv = 0;
 
 	if (!len || size)
@@ -2246,26 +2246,26 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
 	size += sprintf(&buf[size], "Flag-dd   : [ %08lX ]\n",
 							dd->dd_flag);
 
-	*offset = size <= len ? size : len;
-	size = copy_to_user(ubuf, buf, *offset);
-	if (size)
+	iocb->ki_pos = size <= len ? size : len;
+	size = copy_to_iter(buf, iocb->ki_pos, to);
+	if (!size)
 		rv = -EFAULT;
 
 	kfree(buf);
-	return rv ? rv : *offset;
+	return rv ? rv : iocb->ki_pos;
 }
 
 static const struct file_operations mtip_regs_fops = {
 	.owner  = THIS_MODULE,
 	.open   = simple_open,
-	.read   = mtip_hw_read_registers,
+	.read_iter   = mtip_hw_read_registers,
 	.llseek = no_llseek,
 };
 
 static const struct file_operations mtip_flags_fops = {
 	.owner  = THIS_MODULE,
 	.open   = simple_open,
-	.read   = mtip_hw_read_flags,
+	.read_iter   = mtip_hw_read_flags,
 	.llseek = no_llseek,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ