* [RFC PATCH 12/12] lib/iov_iter: Remove import_iovec() and compat_import_iovec()
@ 2020-03-31 13:52 David Laight
0 siblings, 0 replies; only message in thread
From: David Laight @ 2020-03-31 13:52 UTC (permalink / raw)
To: Linux Kernel Mailing List
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-31 13:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 13:52 [RFC PATCH 12/12] lib/iov_iter: Remove import_iovec() and compat_import_iovec() David Laight
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®