[PATCH] tpm: Create cleanup class for tpm_buf

Jarkko Sakkinen jarkko at kernel.org
Wed Jun 25 21:45:36 UTC 2025


On Thu, Jun 26, 2025 at 12:37:56AM +0300, Jarkko Sakkinen wrote:
> From: Jarkko Sakkinen <jarkko.sakkinen at opinsys.com>
> 
> Define a cleanup for tpm_buf, which will caused tpm_buf_destroy()
> automatically called at the end of a function scope. This will
> significantly decrease the likelihood of memory leaks.

Oops, this did not go well.

Here's a corrected version.

"Define a cleanup class for struct tpm_buf, which will take
 the responsibility of calling tpm_buf_destroy() automatically
 when tpm_buf instance is going out of scope."

For the code change itself I noticed that I missed tpm-sysfs.c
i.e., v2 coming post the feedback for this.

BR, Jarkko



More information about the Linux-security-module-archive mailing list