[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yp8j9FilcBMyeL2G@iki.fi>
Date: Tue, 7 Jun 2022 13:09:56 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Jianglei Nie <niejianglei2021@....com>
Cc: jejb@...ux.ibm.com, zohar@...ux.ibm.com, dhowells@...hat.com,
jmorris@...ei.org, serge@...lyn.com,
linux-integrity@...r.kernel.org, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] security:trusted_tpm2: Fix memory leak in
tpm2_key_encode()
"KEYS: trusted: fix memory leak in tpm2_key_encode()"
On Tue, Jun 07, 2022 at 03:46:50PM +0800, Jianglei Nie wrote:
> The function allocates a memory chunk for scratch by kmalloc(), but
~~~ ~~
from with
There's more than one function in Linux - maybe you'd rather want
to write: "tpm2_key_encode() allocates ..."
> it is never freed through the function, which leads to a memory leak.
You can just write "it is never freed, which leads to a memory leak."
> Handle those cases with kfree().
"Free the memory chunk with kfree() in the return paths."
> Signed-off-by: Jianglei Nie <niejianglei2021@....com>
Thank you finding this and providing a fix, it is highly appreciated.
Please don't take the nitpicking with the language personally. Just want
to have it documented in appropriate form.
BR, Jarkko
Powered by blists - more mailing lists