From: Thorsten Blum <thorsten.blum@linux.dev>
To: Tyler Hicks <code@tyhicks.com>,
Thorsten Blum <thorsten.blum@linux.dev>,
Eric Biggers <ebiggers@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Zipeng Zhang <zhangzipeng0@foxmail.com>,
Kees Cook <kees@kernel.org>, Amir Goldstein <amir73il@gmail.com>
Cc: Ard Biesheuvel <ardb@kernel.org>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND] ecryptfs: Remove redundant if checks in encrypt_and_encode_filename
Date: Mon, 9 Mar 2026 23:48:24 +0100 [thread overview]
Message-ID: <20260309224824.85471-3-thorsten.blum@linux.dev> (raw)
The outer if already checks if 'mount_crypt_stat' is true. Drop checking
'mount_crypt_stat' again. Use ecryptfs_printk() while we're at it.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
fs/ecryptfs/crypto.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 3b59346d68c5..bed7a251d8c6 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1802,8 +1802,9 @@ int ecryptfs_encrypt_and_encode_filename(
filename->filename_size = name_size;
rc = ecryptfs_encrypt_filename(filename, mount_crypt_stat);
if (rc) {
- printk(KERN_ERR "%s: Error attempting to encrypt "
- "filename; rc = [%d]\n", __func__, rc);
+ ecryptfs_printk(KERN_ERR,
+ "Error attempting to encrypt filename; rc = [%d]\n",
+ rc);
kfree(filename);
goto out;
}
@@ -1811,9 +1812,8 @@ int ecryptfs_encrypt_and_encode_filename(
NULL, &encoded_name_no_prefix_size,
filename->encrypted_filename,
filename->encrypted_filename_size);
- if (mount_crypt_stat
- && (mount_crypt_stat->flags
- & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))
+ if (mount_crypt_stat->flags
+ & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK)
(*encoded_name_size) =
(ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE
+ encoded_name_no_prefix_size);
@@ -1828,9 +1828,8 @@ int ecryptfs_encrypt_and_encode_filename(
kfree(filename);
goto out;
}
- if (mount_crypt_stat
- && (mount_crypt_stat->flags
- & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK)) {
+ if (mount_crypt_stat->flags
+ & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK) {
memcpy((*encoded_name),
ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX,
ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE);
@@ -1848,9 +1847,9 @@ int ecryptfs_encrypt_and_encode_filename(
rc = -EOPNOTSUPP;
}
if (rc) {
- printk(KERN_ERR "%s: Error attempting to encode "
- "encrypted filename; rc = [%d]\n", __func__,
- rc);
+ ecryptfs_printk(KERN_ERR,
+ "Error attempting to encode encrypted filename; rc = [%d]\n",
+ rc);
kfree((*encoded_name));
(*encoded_name) = NULL;
(*encoded_name_size) = 0;
next reply other threads:[~2026-03-09 22:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 22:48 Thorsten Blum [this message]
2026-03-26 4:59 ` [PATCH RESEND] ecryptfs: Remove redundant if checks in encrypt_and_encode_filename Tyler Hicks
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=20260309224824.85471-3-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=amir73il@gmail.com \
--cc=ardb@kernel.org \
--cc=brauner@kernel.org \
--cc=code@tyhicks.com \
--cc=ebiggers@kernel.org \
--cc=ecryptfs@vger.kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangzipeng0@foxmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.