mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>
To: David Rientjes <rientjes@google.com>,
	"Hook, Gary" <Gary.Hook@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Singh, Brijesh" <brijesh.singh@amd.com>,
	Cfir Cohen <cfir@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: [patch] crypto: ccp - Free ccp if initialization fails
Date: Mon, 24 Jun 2019 13:04:30 +0000	[thread overview]
Message-ID: <15049ef5-c705-037b-b63e-09aa6f098bdf@amd.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1906231217040.15277@chino.kir.corp.google.com>

On 6/23/19 2:18 PM, David Rientjes wrote:
> If ccp_dev_init() fails, kfree() the allocated ccp since it will otherwise
> be leaked.

Not needed. It's allocated with devm_kzalloc(), so it won't be leaked.

Thanks,
Tom

> 
> Fixes: 720419f01832 ("crypto: ccp - Introduce the AMD Secure Processor
> device")
> 
> Reported-by: Cfir Cohen <cfir@google.com>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  drivers/crypto/ccp/ccp-dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
> --- a/drivers/crypto/ccp/ccp-dev.c
> +++ b/drivers/crypto/ccp/ccp-dev.c
> @@ -609,6 +609,7 @@ int ccp_dev_init(struct sp_device *sp)
>  
>  e_err:
>  	sp->ccp_data = NULL;
> +	kfree(ccp);
>  
>  	dev_notice(dev, "ccp initialization failed\n");
>  
> 

  reply	other threads:[~2019-06-24 13:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-23 19:18 David Rientjes
2019-06-24 13:04 ` Lendacky, Thomas [this message]
2019-06-24 14:58   ` Gary R Hook

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=15049ef5-c705-037b-b63e-09aa6f098bdf@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=Gary.Hook@amd.com \
    --cc=brijesh.singh@amd.com \
    --cc=cfir@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®