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-198-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:15:37 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 197/437] scsi: scsi_debug: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/scsi/scsi_debug.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index acf0592d63da..0ce291a5e8fa 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1022,19 +1022,19 @@ static int sdebug_error_open(struct inode *inode, struct file *file)
 	return single_open(file, sdebug_error_show, inode->i_private);
 }
 
-static ssize_t sdebug_error_write(struct file *file, const char __user *ubuf,
-		size_t count, loff_t *ppos)
+static ssize_t sdebug_error_write(struct kiocb *iocb, struct iov_iter *from)
 {
 	char *buf;
 	unsigned int inject_type;
 	struct sdebug_err_inject *inject;
-	struct scsi_device *sdev = (struct scsi_device *)file->f_inode->i_private;
+	struct scsi_device *sdev = iocb->ki_filp->f_inode->i_private;
+	size_t count = iov_iter_count(from);
 
 	buf = kzalloc(count + 1, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
-	if (copy_from_user(buf, ubuf, count)) {
+	if (!copy_from_iter_full(buf, count, from)) {
 		kfree(buf);
 		return -EFAULT;
 	}
@@ -1095,8 +1095,8 @@ static ssize_t sdebug_error_write(struct file *file, const char __user *ubuf,
 
 static const struct file_operations sdebug_error_fops = {
 	.open	= sdebug_error_open,
-	.read	= seq_read,
-	.write	= sdebug_error_write,
+	.read_iter	= seq_read_iter,
+	.write_iter	= sdebug_error_write,
 	.release = single_release,
 };
 
@@ -1117,17 +1117,17 @@ static int sdebug_target_reset_fail_open(struct inode *inode, struct file *file)
 	return single_open(file, sdebug_target_reset_fail_show, inode->i_private);
 }
 
-static ssize_t sdebug_target_reset_fail_write(struct file *file,
-		const char __user *ubuf, size_t count, loff_t *ppos)
+static ssize_t sdebug_target_reset_fail_write(struct kiocb *iocb,
+					      struct iov_iter *from)
 {
 	int ret;
-	struct scsi_target *starget =
-		(struct scsi_target *)file->f_inode->i_private;
+	struct scsi_target *starget = iocb->ki_filp->f_inode->i_private;
 	struct sdebug_target_info *targetip =
 		(struct sdebug_target_info *)starget->hostdata;
+	size_t count = iov_iter_count(from);
 
 	if (targetip) {
-		ret = kstrtobool_from_user(ubuf, count, &targetip->reset_fail);
+		ret = kstrtobool_from_iter(from, count, &targetip->reset_fail);
 		return ret < 0 ? ret : count;
 	}
 	return -ENODEV;
@@ -1135,8 +1135,8 @@ static ssize_t sdebug_target_reset_fail_write(struct file *file,
 
 static const struct file_operations sdebug_target_reset_fail_fops = {
 	.open	= sdebug_target_reset_fail_open,
-	.read	= seq_read,
-	.write	= sdebug_target_reset_fail_write,
+	.read_iter	= seq_read_iter,
+	.write_iter	= sdebug_target_reset_fail_write,
 	.release = single_release,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ