linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 12/12] lib/iov_iter: Remove import_iovec() and compat_import_iovec()
Date: Tue, 31 Mar 2020 13:52:23 +0000	[thread overview]
Message-ID: <d56dbd1ad6914d2d8ef7e90c3862e17f@AcuMS.aculab.com> (raw)


All the callers have been changed to use iovec_import() and
compat_iovec_import().

Signed-off-by: David Laight <david.laight@aculab.com>
---
 include/linux/uio.h |  8 -------
 lib/iov_iter.c      | 61 -----------------------------------------------------
 2 files changed, 69 deletions(-)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index 1e7a3f1..a2762e1 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -271,20 +271,12 @@ struct iovec_cache {
 	struct iovec  iov[UIO_FASTIOV];
 };
 
-ssize_t import_iovec(int type, const struct iovec __user * uvector,
-		 unsigned nr_segs, unsigned fast_segs,
-		 struct iovec **iov, struct iov_iter *i);
-
 struct iovec *iovec_import(int type, const struct iovec __user * uvector,
 		unsigned int nr_segs, struct iovec_cache *cache,
 		struct iov_iter *i);
 
 #ifdef CONFIG_COMPAT
 struct compat_iovec;
-ssize_t compat_import_iovec(int type, const struct compat_iovec __user * uvector,
-		 unsigned nr_segs, unsigned fast_segs,
-		 struct iovec **iov, struct iov_iter *i);
-
 struct iovec *compat_iovec_import(int type,
 		const struct compat_iovec __user * uvector,
 		unsigned int nr_segs, struct iovec_cache *cache,
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index ab33b69..fc31e41 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1739,47 +1739,6 @@ struct iovec *iovec_import(int type, const struct iovec __user * uvector,
 }
 EXPORT_SYMBOL(iovec_import);
 
-/**
- * import_iovec() - Copy an array of &struct iovec from userspace
- *     into the kernel, check that it is valid, and initialize a new
- *     &struct iov_iter iterator to access it.
- *
- * @type: One of %READ or %WRITE.
- * @uvector: Pointer to the userspace array.
- * @nr_segs: Number of elements in userspace array.
- * @fast_segs: Number of elements in @iov.
- * @iov: (input and output parameter) Pointer to pointer to (usually small
- *     on-stack) kernel array.
- * @i: Pointer to iterator that will be initialized on success.
- *
- * If the array pointed to by *@iov is large enough to hold all @nr_segs,
- * then this function places %NULL in *@iov on return. Otherwise, a new
- * array will be allocated and the result placed in *@iov. This means that
- * the caller may call kfree() on *@iov regardless of whether the small
- * on-stack array was used or not (and regardless of whether this function
- * returns an error or not).
- *
- * Return: Negative error code on error, bytes imported on success
- */
-ssize_t import_iovec(int type, const struct iovec __user * uvector,
-		 unsigned nr_segs, unsigned fast_segs,
-		 struct iovec **iov, struct iov_iter *i)
-{
-	struct iovec *iov_kmalloc;
-
-	iov_kmalloc = iovec_import(type, uvector, nr_segs,
-		fast_segs >= UIO_FASTIOV ? (void *)*iov : NULL, i);
-
-	if (IS_ERR(iov_kmalloc)) {
-		*iov = NULL;
-		return PTR_ERR(iov_kmalloc);
-	}
-
-	*iov = iov_kmalloc;
-	return i->count;
-}
-EXPORT_SYMBOL(import_iovec);
-
 #ifdef CONFIG_COMPAT
 #include <linux/compat.h>
 
@@ -1849,26 +1808,6 @@ struct iovec *compat_iovec_import(int type,
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL(compat_iovec_import);
-
-ssize_t compat_import_iovec(int type,
-		const struct compat_iovec __user * uvector,
-		unsigned nr_segs, unsigned fast_segs,
-		struct iovec **iov, struct iov_iter *i)
-{
-	struct iovec *iov_kmalloc;
-
-	iov_kmalloc = compat_iovec_import(type, uvector, nr_segs,
-		fast_segs >= UIO_FASTIOV ? (void *)*iov : NULL, i);
-
-	if (IS_ERR(iov_kmalloc)) {
-		*iov = NULL;
-		return PTR_ERR(iov_kmalloc);
-	}
-
-	*iov = iov_kmalloc;
-	return i->count;
-}
-EXPORT_SYMBOL(compat_import_iovec);
 #endif
 
 int import_single_range(int rw, void __user *buf, size_t len,
-- 
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=d56dbd1ad6914d2d8ef7e90c3862e17f@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;
as well as URLs for NNTP newsgroup(s).