All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: David Howells <dhowells@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Vitaly Chikunov <vt@altlinux.org>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, <keyrings@vger.kernel.org>,
	<linux-crypto@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: [PATCH] KEYS: asymmetric: fix error return code in software_key_query()
Date: Mon, 22 Jun 2020 11:21:36 +0000	[thread overview]
Message-ID: <20200622112136.72745-1-weiyongjun1@huawei.com> (raw)

Fix to return negative error code -ENOMEM from kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: f1774cb8956a ("X.509: parse public key parameters from x509 for akcipher")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 crypto/asymmetric_keys/public_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index d7f43d4ea925..c15bde024b4c 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -119,6 +119,7 @@ static int software_key_query(const struct kernel_pkey_params *params,
 	if (IS_ERR(tfm))
 		return PTR_ERR(tfm);
 
+	ret = -ENOMEM;
 	key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
 		      GFP_KERNEL);
 	if (!key)




WARNING: multiple messages have this Message-ID (diff)
From: Wei Yongjun <weiyongjun1@huawei.com>
To: David Howells <dhowells@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Vitaly Chikunov <vt@altlinux.org>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
	keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] KEYS: asymmetric: fix error return code in software_key_query()
Date: Mon, 22 Jun 2020 11:21:36 +0000	[thread overview]
Message-ID: <20200622112136.72745-1-weiyongjun1@huawei.com> (raw)

Fix to return negative error code -ENOMEM from kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: f1774cb8956a ("X.509: parse public key parameters from x509 for akcipher")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 crypto/asymmetric_keys/public_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index d7f43d4ea925..c15bde024b4c 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -119,6 +119,7 @@ static int software_key_query(const struct kernel_pkey_params *params,
 	if (IS_ERR(tfm))
 		return PTR_ERR(tfm);
 
+	ret = -ENOMEM;
 	key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
 		      GFP_KERNEL);
 	if (!key)

             reply	other threads:[~2020-06-22 11:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 11:21 Wei Yongjun [this message]
2020-06-22 11:21 ` [PATCH] KEYS: asymmetric: fix error return code in software_key_query() Wei Yongjun
2020-07-15 22:28 ` [PATCH] keys: " David Howells
2020-07-15 22:28   ` David Howells
2020-07-23  1:32   ` Jarkko Sakkinen
2020-07-23  1:32     ` Jarkko Sakkinen
2020-07-23  1:36     ` Jarkko Sakkinen
2020-07-23  1:36       ` Jarkko Sakkinen
2020-07-23  7:31   ` David Howells
2020-07-23  7:31     ` David Howells
2020-07-23  7:42   ` David Howells
2020-07-23  7:42     ` David Howells
2020-07-24  7:16     ` Jarkko Sakkinen
2020-07-24  7:16       ` Jarkko Sakkinen

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=20200622112136.72745-1-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=vt@altlinux.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.