From: David Laight <David.Laight@ACULAB.COM>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 05/12] scsi: Use iovec_import() instead of import_iovec().
Date: Tue, 31 Mar 2020 13:52:03 +0000 [thread overview]
Message-ID: <56b125de37a842768754905876f4339c@AcuMS.aculab.com> (raw)
Signed-off-by: David Laight <david.laight@aculab.com>
---
block/scsi_ioctl.c | 14 ++++++++------
drivers/scsi/sg.c | 14 +++++++-------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index b4e73d5..df3a11b 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -327,20 +327,22 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
ret = 0;
if (hdr->iovec_count) {
struct iov_iter i;
- struct iovec *iov = NULL;
+ struct iovec *iov;
#ifdef CONFIG_COMPAT
if (in_compat_syscall())
- ret = compat_import_iovec(rq_data_dir(rq),
+ iov = compat_iovec_import(rq_data_dir(rq),
hdr->dxferp, hdr->iovec_count,
- 0, &iov, &i);
+ NULL, &i);
else
#endif
- ret = import_iovec(rq_data_dir(rq),
+ iov = iovec_import(rq_data_dir(rq),
hdr->dxferp, hdr->iovec_count,
- 0, &iov, &i);
- if (ret < 0)
+ NULL, &i);
+ if (IS_ERR(iov)) {
+ ret = PTR_ERR(iov);
goto out_free_cdb;
+ }
/* SG_IO howto says that the shorter of the two wins */
iov_iter_truncate(&i, hdr->dxfer_len);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 4e6af59..4733f7b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1813,19 +1813,19 @@ static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned lon
}
if (iov_count) {
- struct iovec *iov = NULL;
+ struct iovec *iov;
struct iov_iter i;
#ifdef CONFIG_COMPAT
if (in_compat_syscall())
- res = compat_import_iovec(rw, hp->dxferp, iov_count,
- 0, &iov, &i);
+ iov = compat_iovec_import(rw, hp->dxferp, iov_count,
+ NULL, &i);
else
#endif
- res = import_iovec(rw, hp->dxferp, iov_count,
- 0, &iov, &i);
- if (res < 0)
- return res;
+ iov = iovec_import(rw, hp->dxferp, iov_count,
+ NULL, &i);
+ if (IS_ERR(iov))
+ return PTR_ERR(iov);
iov_iter_truncate(&i, hp->dxfer_len);
if (!iov_iter_count(&i)) {
--
1.8.1.2
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
reply other threads:[~2020-03-31 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56b125de37a842768754905876f4339c@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®