From: walter harms <wharms@bfs.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: lrw - Fix an error handling path in 'create()'
Date: Mon, 09 Oct 2017 21:22:36 +0000 [thread overview]
Message-ID: <59DBE89C.3090700@bfs.de> (raw)
In-Reply-To: <53e4cc621176b8aeeb58e493b133be853c66ef49.1507445539.git.christophe.jaillet@wanadoo.fr>
Am 08.10.2017 11:39, schrieb Christophe JAILLET:
> All error handling paths 'goto err_drop_spawn' except this one.
> In order to avoid some resources leak, we should do it as well here.
>
> Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> crypto/lrw.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/lrw.c b/crypto/lrw.c
> index a8bfae4451bf..eb681e9fe574 100644
> --- a/crypto/lrw.c
> +++ b/crypto/lrw.c
> @@ -610,8 +610,10 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb)
> ecb_name[len - 1] = 0;
>
> if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
> - "lrw(%s)", ecb_name) >= CRYPTO_MAX_ALG_NAME)
this check can be done more easy,
the length of ecb_name is len
the length of inst->alg.base.cra_name is CRYPTO_MAX_ALG_NAME
if CRYPTO_MAX_ALG_NAME-len < "lrw()" < 5
no need to involve snprintf()
just my 2 cents
re,
wh
> - return -ENAMETOOLONG;
> + "lrw(%s)", ecb_name) >= CRYPTO_MAX_ALG_NAME) {
> + err = -ENAMETOOLONG;
> + goto err_drop_spawn;
> + }
> }
>
> inst->alg.base.cra_flags = alg->base.cra_flags & CRYPTO_ALG_ASYNC;
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: lrw - Fix an error handling path in 'create()'
Date: Mon, 09 Oct 2017 23:22:36 +0200 [thread overview]
Message-ID: <59DBE89C.3090700@bfs.de> (raw)
In-Reply-To: <53e4cc621176b8aeeb58e493b133be853c66ef49.1507445539.git.christophe.jaillet@wanadoo.fr>
Am 08.10.2017 11:39, schrieb Christophe JAILLET:
> All error handling paths 'goto err_drop_spawn' except this one.
> In order to avoid some resources leak, we should do it as well here.
>
> Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> crypto/lrw.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/lrw.c b/crypto/lrw.c
> index a8bfae4451bf..eb681e9fe574 100644
> --- a/crypto/lrw.c
> +++ b/crypto/lrw.c
> @@ -610,8 +610,10 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb)
> ecb_name[len - 1] = 0;
>
> if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME,
> - "lrw(%s)", ecb_name) >= CRYPTO_MAX_ALG_NAME)
this check can be done more easy,
the length of ecb_name is len
the length of inst->alg.base.cra_name is CRYPTO_MAX_ALG_NAME
if CRYPTO_MAX_ALG_NAME-len < "lrw()" < 5
no need to involve snprintf()
just my 2 cents
re,
wh
> - return -ENAMETOOLONG;
> + "lrw(%s)", ecb_name) >= CRYPTO_MAX_ALG_NAME) {
> + err = -ENAMETOOLONG;
> + goto err_drop_spawn;
> + }
> }
>
> inst->alg.base.cra_flags = alg->base.cra_flags & CRYPTO_ALG_ASYNC;
next prev parent reply other threads:[~2017-10-09 21:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-08 9:39 [PATCH 0/2] crypto: lrw - Fixes for the 'create()' function Christophe JAILLET
2017-10-08 9:39 ` Christophe JAILLET
2017-10-08 9:39 ` [PATCH 1/2] crypto: lrw - Fix an error handling path in 'create()' Christophe JAILLET
2017-10-08 9:39 ` Christophe JAILLET
2017-10-09 21:22 ` walter harms [this message]
2017-10-09 21:22 ` walter harms
2017-10-10 6:05 ` Christophe JAILLET
2017-10-10 6:05 ` Christophe JAILLET
2017-10-10 8:32 ` walter harms
2017-10-10 8:32 ` walter harms
2017-10-08 9:39 ` [PATCH 2/2] crypto: lrw - Check for incorrect cipher name Christophe JAILLET
2017-10-08 9:39 ` Christophe JAILLET
2017-10-12 15:10 ` [PATCH 0/2] crypto: lrw - Fixes for the 'create()' function Herbert Xu
2017-10-12 15:10 ` 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=59DBE89C.3090700@bfs.de \
--to=wharms@bfs.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@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.