lkml.org 
[lkml]   [2020]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 12/12] lib/iov_iter: Remove import_iovec() and compat_import_iovec()
Date

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)

\
 
 \ /
  Last update: 2020-03-31 15:53    [W:0.044 / U:1.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site