linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 10/13] keys: Pass a NULL pointer to kernel_read and kernel_write
Date: Sat,  3 Oct 2020 03:55:31 +0100	[thread overview]
Message-ID: <20201003025534.21045-11-willy@infradead.org> (raw)
In-Reply-To: <20201003025534.21045-1-willy@infradead.org>

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

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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


  parent reply	other threads:[~2020-10-03  2:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03  2:55 [PATCH 00/13] Clean up kernel_read/kernel_write Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 01/13] fs: Allow a NULL pos pointer to __kernel_write Matthew Wilcox (Oracle)
2020-10-15 17:56   ` Christoph Hellwig
2020-10-03  2:55 ` [PATCH 02/13] fs: Allow a NULL pos pointer to __kernel_read Matthew Wilcox (Oracle)
2020-10-15 17:56   ` Christoph Hellwig
2020-10-03  2:55 ` [PATCH 03/13] fs/acct: Pass a NULL pointer to __kernel_write Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 04/13] um/mconsole: Pass a NULL pointer to kernel_read Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 05/13] x86/aout: " Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 06/13] aout: " Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 07/13] binfmt_flat: " Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 08/13] exec: " Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 09/13] bpfilter: Pass a NULL pointer to kernel_read and kernel_write Matthew Wilcox (Oracle)
2020-10-03  2:55 ` Matthew Wilcox (Oracle) [this message]
2020-10-03  2:55 ` [PATCH 11/13] target: Pass a NULL pointer to kernel_write Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 12/13] proc: " Matthew Wilcox (Oracle)
2020-10-03  2:55 ` [PATCH 13/13] usermode: " Matthew Wilcox (Oracle)
2020-10-03  3:47 ` [PATCH 00/13] Clean up kernel_read/kernel_write Al Viro
2020-10-09 22:07   ` Eric Biggers
2020-10-15 17:56 ` Christoph Hellwig
2020-10-15 18:23   ` Al Viro

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=20201003025534.21045-11-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).