The set of eCryptfs changes for the 7.2-rc1 merge window consists of:

- Code cleanup to replace kmalloc()/snprintf() with kasprintf()
 - Code cleanup to simplify code flow by removing an unnecessary variable
 
 There should be no functional changes. The patches have all spent time
 in linux-next and they pass all tests in the ecryptfs-utils tree.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEKvuQkp28KvPJn/fVfL7QslYSS/0FAmo96M8RHGNvZGVAdHlo
 aWNrcy5jb20ACgkQfL7QslYSS/0RyRAAv1eObbk5F6oyz0oii7u+AJVhoVHiGUoS
 rHSo3JI5xA/0fM6jArXmiLqF6twyU0hzIiR04KIhp6IC6TvrSFuCPXrPRSzTQ1Nn
 3ETW4W1nbie0T9fZqOaGLShTYK7PhhaJltS/qHmSzqZJXaLdy5QBR+vn89wBtCq7
 23r9x2i097Qt4sP+SZoa5Auq3EEfj6+ZjX5Y2Ve6uOSXL5POh0vysiMAt9ROZfd9
 jSNIM3EtfirKtFuZ2lcMBnBsZMSh7/6h2f0qCgptAQyVWEkINcW1i3wjv2durIe7
 q5ws54BQ2eSdjA4AyL/kl/TtuV06k73XsTb3sAi+Au1T3MfVgEeXoYQA8MwYCgEp
 /qbBlnVA8Zr14wNEkBUPH7nVgLmpY6pF/GyQxiL017Nroa+hjyn9thsqNnA/xMzf
 CCsYhpw3Hn80pKyEvONtGxuTpMMmqjzrkoUCP5YmIo3tHibl4IlfxGhFHPtNEGtU
 9/hAB4FuASnjgiYKp/UOnu6oPLww1WRMHw1hM4KYJxVYt0f/PxVp26QExCSvrMG4
 xrl8kgt9CvPSRAWkhfPHecFvOi7a0UlscjdWlC4jh2eqnriMBhQzW4iCQQnMflMd
 y080VNlbOZcjyK7nz2HBhaG8nTG9mVPlXw7DjjVf42AoEsWzmkqDwfCG06oX/Vps
 2PPQv+hjHUw=
 =TCHV
 -----END PGP SIGNATURE-----

Merge tag 'ecryptfs-7.2-rc1-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs

Pull ecryptfs updates from Tyler Hicks:
 "No functional changes, just code cleanups:

   - replace kmalloc()/snprintf() with kasprintf()

   - simplify code flow by removing an unnecessary variable"

* tag 'ecryptfs-7.2-rc1-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
  ecryptfs: use kasprintf in ecryptfs_crypto_api_algify_cipher_name
  ecryptfs: remove redundant variable found_auth_tok
This commit is contained in:
Linus Torvalds 2026-06-26 08:24:06 -07:00
commit c292ea294d
2 changed files with 12 additions and 28 deletions

View File

@ -49,25 +49,15 @@ void ecryptfs_from_hex(char *dst, char *src, int dst_size)
}
static int ecryptfs_crypto_api_algify_cipher_name(char **algified_name,
char *cipher_name,
char *chaining_modifier)
const char *cipher_name,
const char *chaining_modifier)
{
int cipher_name_len = strlen(cipher_name);
int chaining_modifier_len = strlen(chaining_modifier);
int algified_name_len;
int rc;
(*algified_name) = kasprintf(GFP_KERNEL, "%s(%s)", chaining_modifier,
cipher_name);
if (!(*algified_name))
return -ENOMEM;
algified_name_len = (chaining_modifier_len + cipher_name_len + 3);
(*algified_name) = kmalloc(algified_name_len, GFP_KERNEL);
if (!(*algified_name)) {
rc = -ENOMEM;
goto out;
}
snprintf((*algified_name), algified_name_len, "%s(%s)",
chaining_modifier, cipher_name);
rc = 0;
out:
return rc;
return 0;
}
/**

View File

@ -1718,7 +1718,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
struct dentry *ecryptfs_dentry)
{
size_t i = 0;
size_t found_auth_tok;
size_t next_packet_is_auth_tok_packet;
LIST_HEAD(auth_tok_list);
struct ecryptfs_auth_tok *matching_auth_tok;
@ -1822,7 +1821,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
* the metadata. There may be several potential matches, but
* just one will be sufficient to decrypt to get the FEK. */
find_next_matching_auth_tok:
found_auth_tok = 0;
list_for_each_entry(auth_tok_list_item, &auth_tok_list, list) {
candidate_auth_tok = &auth_tok_list_item->auth_tok;
if (unlikely(ecryptfs_verbosity > 0)) {
@ -1843,17 +1841,13 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
&matching_auth_tok,
crypt_stat->mount_crypt_stat,
candidate_auth_tok_sig);
if (!rc) {
found_auth_tok = 1;
if (!rc)
goto found_matching_auth_tok;
}
}
if (!found_auth_tok) {
ecryptfs_printk(KERN_ERR, "Could not find a usable "
"authentication token\n");
rc = -EIO;
goto out_wipe_list;
}
ecryptfs_printk(KERN_ERR,
"Could not find a usable authentication token\n");
rc = -EIO;
goto out_wipe_list;
found_matching_auth_tok:
if (candidate_auth_tok->token_type == ECRYPTFS_PRIVATE_KEY) {
memcpy(&(candidate_auth_tok->token.private_key),