[PATCH 10/13] keys: Pass a NULL pointer to kernel_read and kernel_write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We want to start at 0 and do not care about the updated value.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 security/keys/big_key.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/security/keys/big_key.c b/security/keys/big_key.c
index 691347dea3c1..ffe70ff84665 100644
--- a/security/keys/big_key.c
+++ b/security/keys/big_key.c
@@ -79,8 +79,6 @@ int big_key_preparse(struct key_preparsed_payload *prep)
 		 * Since the key is random for each file, we can set the nonce
 		 * to zero, provided we never define a ->update() call.
 		 */
-		loff_t pos = 0;
-
 		buf = kvmalloc(enclen, GFP_KERNEL);
 		if (!buf)
 			return -ENOMEM;
@@ -106,7 +104,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
 			goto err_enckey;
 		}
 
-		written = kernel_write(file, buf, enclen, &pos);
+		written = kernel_write(file, buf, enclen, NULL);
 		if (written != enclen) {
 			ret = written;
 			if (written >= 0)
@@ -240,7 +238,6 @@ long big_key_read(const struct key *key, char *buffer, size_t buflen)
 		struct file *file;
 		u8 *buf, *enckey = (u8 *)key->payload.data[big_key_data];
 		size_t enclen = datalen + CHACHA20POLY1305_AUTHTAG_SIZE;
-		loff_t pos = 0;
 
 		buf = kvmalloc(enclen, GFP_KERNEL);
 		if (!buf)
@@ -253,7 +250,7 @@ long big_key_read(const struct key *key, char *buffer, size_t buflen)
 		}
 
 		/* read file to kernel and decrypt */
-		ret = kernel_read(file, buf, enclen, &pos);
+		ret = kernel_read(file, buf, enclen, NULL);
 		if (ret != enclen) {
 			if (ret >= 0)
 				ret = -EIO;
-- 
2.28.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux