[RFC PATCH 06/12] security/keys: Use iovec_import() instead of import_iovec().

From: David Laight
Date: Tue Mar 31 2020 - 09:52:14 EST


Signed-off-by: David Laight <david.laight@xxxxxxxxxx>
---
security/keys/compat.c | 11 +++++------
security/keys/keyctl.c | 10 +++++-----
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/security/keys/compat.c b/security/keys/compat.c
index b975f8f..178412a 100644
--- a/security/keys/compat.c
+++ b/security/keys/compat.c
@@ -26,18 +26,17 @@ static long compat_keyctl_instantiate_key_iov(
unsigned ioc,
key_serial_t ringid)
{
- struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
+ struct iovec_cache cache;
struct iov_iter from;
+ struct iovec *iov;
long ret;

if (!_payload_iov)
ioc = 0;

- ret = compat_import_iovec(WRITE, _payload_iov, ioc,
- ARRAY_SIZE(iovstack), &iov,
- &from);
- if (ret < 0)
- return ret;
+ iov = compat_iovec_import(WRITE, _payload_iov, ioc, &cache, &from);
+ if (IS_ERR(iov))
+ return PTR_ERR(iov);

ret = keyctl_instantiate_key_common(id, &from, ringid);
kfree(iov);
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 9b898c9..e93b4e6 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1208,17 +1208,17 @@ long keyctl_instantiate_key_iov(key_serial_t id,
unsigned ioc,
key_serial_t ringid)
{
- struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
+ struct iovec_cache cache;
struct iov_iter from;
+ struct iovec *iov;
long ret;

if (!_payload_iov)
ioc = 0;

- ret = import_iovec(WRITE, _payload_iov, ioc,
- ARRAY_SIZE(iovstack), &iov, &from);
- if (ret < 0)
- return ret;
+ iov = iovec_import(WRITE, _payload_iov, ioc, &cache, &from);
+ if (IS_ERR(iov))
+ return PTR_ERR(iov);
ret = keyctl_instantiate_key_common(id, &from, ringid);
kfree(iov);
return ret;
--
1.8.1.2

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)