Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370107

[PATCH 09/13] fscrypto: make fname_encrypt() actually return length of ciphertext

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 09/13] fscrypto: make fname_encrypt() actually return length of ciphertext
Date Sun, 03 Apr 2016 07:30:02 +0200
Message-ID <rjILM-748-27@gated-at.bofh.it> (permalink)
References <rjILL-748-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uVmSDcnZq2KwrV0djxjGKEqW63PI0ai4qO+n/jnVzvU=; b=ChNk+Kd+t3U5QyMZiCIlkbfGKyGSKN+HVsyfOfaed2qKIkvgkYsJ4N8HkEJWAsqZT6 f5HyLY4A1K9MM+df/48bfIANDWWdaOMJkd15uZsHB3Jly6/kd32yMGb7h3/lu0KLhnu3 OvI4KGIpqNDBXuWy8vRkng6S8T4qYN7ErGzx9q0obFclJLGyRWWRUHup9dGrmnyW9+8o PVDjACRG6uL/n2ulD9gB0TRoFypq0aOVs9YtrakA7+O/X41yKj4plmAnq9DmOj7mK/0I qQMVQN5MbZE2D/mmqSv6C2FeekQ+BkTju1ensUX4ng1iXFKABXm/2aLrN4XzeQA2MMMJ A4Pg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uVmSDcnZq2KwrV0djxjGKEqW63PI0ai4qO+n/jnVzvU=; b=ZhCRdQ1GCGW9a6dpNXtGDO00cfugNclshBuSIu6Jai2Xu+O66Jpep88NXYGhxN2b5a 4BZWD6Gh9vtoibuAu9pWKjBSNKarXUvHnptEzYDtEe3uO3tmxWmKKI7LyPrWHGCNDAXN 11rtXlpxtQcTAyOXpwwiy93tmt/2AXFD+9284JkLP+fQP+0njFcFgQqWbaGtwETlLliV RRMZD21GkAe50qyHSJylONEj1d1PJUYdBR58RXtzXDzq21JhtYGOsIJXBg81+C50KwGJ O5rw41t+7/Ed5ehM23rTUDxmIfZb8UdUVcgzcovsLPbxsajC4Lxr6eWUk0cqCGrWo16M g8XQ==
X-Gm-Message-State AD7BkJJF3L89Y/hPgZwMLTt7z/49Z1aO1PBCYXGsXrSxJT6TOhwro8sx3+5KpJ4DHyB/+g==
X-Received by 10.50.154.10 with SMTP id vk10mr5497067igb.74.1459661023989; Sat, 02 Apr 2016 22:23:43 -0700 (PDT)
X-Mailer git-send-email 2.7.4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jaegeuk@kernel.org, tytso@mit.edu, mhalcrow@google.com, Eric Biggers <ebiggers3@gmail.com>
X-Original-Date Sun, 3 Apr 2016 00:22:00 -0500
X-Original-Message-ID <1459660924-2960-10-git-send-email-ebiggers3@gmail.com>
X-Original-References <1459660924-2960-1-git-send-email-ebiggers3@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1370107

Show key headers only | View raw


This makes the return value match the comment.  Previously it would
actually return 0 if encryption was successful.  (No callers currently
care.)

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
---
 fs/crypto/fname.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index e5c6959..5b10b73 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -100,12 +100,13 @@ static int fname_encrypt(struct inode *inode,
 	}
 	kfree(alloc_buf);
 	skcipher_request_free(req);
-	if (res < 0)
+	if (res < 0) {
 		printk_ratelimited(KERN_ERR
 				"%s: Error (error code %d)\n", __func__, res);
-
+		return res;
+	}
 	oname->len = ciphertext_len;
-	return res;
+	return ciphertext_len;
 }
 
 /*
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] fscrypto: cleanups and fixes Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 12/13] fscrypto: require write access to mount to set encryption policy Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 04/13] fscrypto: return bool instead of int where appropriate Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 10/13] fscrypto: restrict setting new policy to empty files and directories only Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 05/13] fscrypto: comment improvements and fixes Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 07/13] fscrypto: simplify building key descriptor string Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 02/13] fscrypto: rename some functions for clarity Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
    Re: [PATCH 02/13] fscrypto: rename some functions for clarity Theodore Ts'o <tytso@mit.edu> - 2016-04-03 09:50 +0200
  [PATCH 11/13] fscrypto: restrict setting encryption policy to inode owner Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 08/13] fscrypto: use standard macros from kernel.h Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 09/13] fscrypto: make fname_encrypt() actually return length of ciphertext Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 13/13] fscrypto: improve error handling in fscrypt_set_policy() Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 06/13] fscrypto: crypto_alloc_skcipher() always returns an ERR_PTR(), never NULL Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 03/13] fscrypto: rename functions to load and unload inode encryption info Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200

csiph-web