From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 27/35] crypto: cryptd - Switch to template create API
Date: Wed, 15 Jul 2009 10:47:23 +0200 [thread overview]
Message-ID: <20090715084723.GK20288@secunet.com> (raw)
In-Reply-To: <E1MQyiz-00051d-KJ@gondolin.me.apana.org.au>
On Wed, Jul 15, 2009 at 03:16:21PM +0800, Herbert Xu wrote:
> crypto: cryptd - Switch to template create API
>
> This patch changes cryptd to use the template->create function
> instead of alloc in anticipation for the switch to new style
> ahash algorithms.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> ---
>
> crypto/cryptd.c | 53 ++++++++++++++++++++++++++----------------------
> crypto/internal.h | 3 --
> include/crypto/algapi.h | 3 ++
> 3 files changed, 32 insertions(+), 27 deletions(-)
>
> diff --git a/crypto/cryptd.c b/crypto/cryptd.c
> index 6e6722e..ad58f51 100644
> --- a/crypto/cryptd.c
> +++ b/crypto/cryptd.c
> @@ -287,8 +287,9 @@ out_free_inst:
> goto out;
> }
>
> -static struct crypto_instance *cryptd_alloc_blkcipher(
> - struct rtattr **tb, struct cryptd_queue *queue)
> +static int cryptd_create_blkcipher(struct crypto_template *tmpl,
> + struct rtattr **tb,
> + struct cryptd_queue *queue)
> {
> struct cryptd_instance_ctx *ctx;
> struct crypto_instance *inst;
> @@ -298,7 +299,7 @@ static struct crypto_instance *cryptd_alloc_blkcipher(
> alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_BLKCIPHER,
> CRYPTO_ALG_TYPE_MASK);
> if (IS_ERR(alg))
> - return ERR_CAST(alg);
> + return PTR_ERR(alg);
>
> inst = cryptd_alloc_instance(alg, sizeof(*ctx));
> if (IS_ERR(inst))
> @@ -330,14 +331,16 @@ static struct crypto_instance *cryptd_alloc_blkcipher(
> inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue;
> inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue;
>
> + err = crypto_register_instance(tmpl, inst);
> + if (err) {
> + crypto_drop_spawn(&ctx->spawn);
> +out_free_inst:
> + kfree(inst);
> + }
> +
> out_put_alg:
> crypto_mod_put(alg);
> - return inst;
> -
> -out_free_inst:
> - kfree(inst);
> - inst = ERR_PTR(err);
> - goto out_put_alg;
> + return err;
This introduces an uninitialized return value warning. err is not initialized
if cryptd_alloc_instance() fails.
> }
>
> static int cryptd_hash_init_tfm(struct crypto_tfm *tfm)
> @@ -502,8 +505,8 @@ static int cryptd_hash_digest_enqueue(struct ahash_request *req)
> return cryptd_hash_enqueue(req, cryptd_hash_digest);
> }
>
> -static struct crypto_instance *cryptd_alloc_hash(
> - struct rtattr **tb, struct cryptd_queue *queue)
> +static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
> + struct cryptd_queue *queue)
> {
> struct hashd_instance_ctx *ctx;
> struct crypto_instance *inst;
> @@ -513,7 +516,7 @@ static struct crypto_instance *cryptd_alloc_hash(
>
> salg = shash_attr_alg(tb[1], 0, 0);
> if (IS_ERR(salg))
> - return ERR_CAST(salg);
> + return PTR_ERR(salg);
>
> alg = &salg->base;
> inst = cryptd_alloc_instance(alg, sizeof(*ctx));
> @@ -542,34 +545,36 @@ static struct crypto_instance *cryptd_alloc_hash(
> inst->alg.cra_ahash.setkey = cryptd_hash_setkey;
> inst->alg.cra_ahash.digest = cryptd_hash_digest_enqueue;
>
> + err = crypto_register_instance(tmpl, inst);
> + if (err) {
> + crypto_drop_shash(&ctx->spawn);
> +out_free_inst:
> + kfree(inst);
> + }
> +
> out_put_alg:
> crypto_mod_put(alg);
> - return inst;
> -
> -out_free_inst:
> - kfree(inst);
> - inst = ERR_PTR(err);
> - goto out_put_alg;
> + return err;
Same here.
I'll send a patch to fix it.
next prev parent reply other threads:[~2009-07-15 8:44 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-15 7:14 [PATCH 0/35] Converting ahash to new style Herbert Xu
2009-07-15 7:15 ` [PATCH 1/35] crypto: shash - Export/import hash state only Herbert Xu
2009-07-15 7:15 ` [PATCH 2/35] crypto: shash - Move finup/digest null checks to registration time Herbert Xu
2009-07-15 7:15 ` [PATCH 3/35] crypto: sha1_generic - Add export/import support Herbert Xu
2009-07-15 7:15 ` [PATCH 4/35] crypto: sha256_generic - Use 64-bit counter like sha1 Herbert Xu
2009-07-15 7:15 ` [PATCH 5/35] crypto: sha256_generic - Add export/import support Herbert Xu
2009-07-15 7:15 ` [PATCH 6/35] crypto: sha1-s390 " Herbert Xu
2009-07-15 7:16 ` [PATCH 7/35] crypto: sha256-s390 " Herbert Xu
2009-07-15 7:16 ` [PATCH 8/35] crypto: padlock - Use shash fallback for sha Herbert Xu
2009-07-15 7:16 ` [PATCH 9/35] crypto: shash - Move null setkey check to registration time Herbert Xu
2009-07-15 7:16 ` [PATCH 10/35] crypto: async - Use kzfree for requests Herbert Xu
2009-07-15 7:16 ` [PATCH 11/35] crypto: shash - Make descsize a run-time attribute Herbert Xu
2009-07-15 7:16 ` [PATCH 12/35] crypto: padlock - Switch sha to shash Herbert Xu
2009-07-15 10:28 ` Steffen Klassert
2009-07-15 10:30 ` Herbert Xu
2009-07-15 10:36 ` Steffen Klassert
2009-07-15 10:38 ` Herbert Xu
2009-07-15 10:47 ` Steffen Klassert
2009-07-15 7:16 ` [PATCH 13/35] crypto: hmac - Switch " Herbert Xu
2009-07-15 7:16 ` [PATCH 14/35] crypto: xcbc " Herbert Xu
2009-07-15 7:16 ` [PATCH 15/35] crypto: authenc - Remove reference to crypto_hash Herbert Xu
2009-07-15 7:16 ` [PATCH 16/35] crypto: hash - Remove legacy hash/digest implementaion Herbert Xu
2009-07-15 7:16 ` [PATCH 17/35] crypto: shash - Export async functions Herbert Xu
2009-07-15 7:16 ` [PATCH 18/35] crypto: cryptd - Use shash algorithms Herbert Xu
2009-07-15 7:16 ` [PATCH 19/35] crypto: ahash - Add crypto_ahash_set_reqsize Herbert Xu
2009-07-15 7:16 ` [PATCH 20/35] crypto: cryptd - Use crypto_ahash_set_reqsize Herbert Xu
2009-07-15 7:16 ` [PATCH 21/35] crypto: crypto4xx " Herbert Xu
2009-07-15 7:16 ` [PATCH 22/35] crypto: api - Remove frontend argument from extsize/init_tfm Herbert Xu
2009-07-15 7:16 ` [PATCH 23/35] crypto: ahash - Convert to new style algorithms Herbert Xu
2009-07-15 7:16 ` [PATCH 24/35] crypto: ahash - Add instance/spawn support Herbert Xu
2009-07-15 7:16 ` [PATCH 25/35] crypto: tcrypt - Add mask parameter Herbert Xu
2009-07-15 7:16 ` [PATCH 26/35] crypto: hash - Add helpers to free spawns Herbert Xu
2009-07-15 7:16 ` [PATCH 27/35] crypto: cryptd - Switch to template create API Herbert Xu
2009-07-15 8:47 ` Steffen Klassert [this message]
2009-07-15 8:48 ` Herbert Xu
2009-07-15 7:16 ` [PATCH 28/35] crypto: cryptd - Switch to new style ahash Herbert Xu
2009-07-15 7:16 ` [PATCH 29/35] crypto: crypto4xx " Herbert Xu
2009-07-15 7:16 ` [PATCH 30/35] crypto: ahash - Remove old_ahash_alg Herbert Xu
2009-07-15 7:16 ` [PATCH 31/35] crypto: hash - Zap unaligned buffers Herbert Xu
2009-07-15 7:16 ` [PATCH 32/35] crypto: shash - Fix alignment in unaligned operations Herbert Xu
2009-07-15 7:16 ` [PATCH 33/35] crypto: ahash - Use GFP_KERNEL in unaligned setkey Herbert Xu
2009-07-15 7:16 ` [PATCH 34/35] crypto: ahash - Add unaligned handling and default operations Herbert Xu
2009-07-15 7:16 ` [PATCH 35/35] crypto: crypto4xx - Disable SHA implementation Herbert Xu
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=20090715084723.GK20288@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@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.