From: Thorsten Blum <thorsten.blum@linux.dev>
To: Tyler Hicks <code@tyhicks.com>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ecryptfs: use kasprintf in ecryptfs_crypto_api_algify_cipher_name
Date: Wed, 3 Jun 2026 00:37:42 +0200 [thread overview]
Message-ID: <ah9bNrD59WiPRBRU@linux.dev> (raw)
In-Reply-To: <20260518073842.57501-4-thorsten.blum@linux.dev>
Gentle ping?
On Mon, May 18, 2026 at 09:38:45AM +0200, Thorsten Blum wrote:
> Use kasprintf() to simplify ecryptfs_crypto_api_algify_cipher_name().
>
> Use const char * for the read-only cipher name and chaining modifier
> while at it.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> fs/ecryptfs/crypto.c | 24 +++++++-----------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
> index 5ef67b2674ee..74b02b55e3f6 100644
> --- a/fs/ecryptfs/crypto.c
> +++ b/fs/ecryptfs/crypto.c
> @@ -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;
> }
>
> /**
next prev parent reply other threads:[~2026-06-02 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 7:38 [PATCH] ecryptfs: use kasprintf in ecryptfs_crypto_api_algify_cipher_name Thorsten Blum
2026-06-02 22:37 ` Thorsten Blum [this message]
2026-06-04 19:53 ` 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=ah9bNrD59WiPRBRU@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=code@tyhicks.com \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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.