Re: [PATCH] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path

From: Jarkko Sakkinen

Date: Mon Nov 09 2026 - 10:27:38 EST


On Mon, Nov 09, 2026 at 05:25:49PM +0200, Jarkko Sakkinen wrote:
> On Mon, Nov 09, 2026 at 09:25:24AM +0100, Takashi Iwai wrote:
> > When devm_add_action() returns an error, we do NULL-clear
> > log->bios_event_log unnecessarily before calling tpm_bios_log_free(),
> > and it would lead to a memory leak of the allocated log buffer.
>
> I don't understand this. "NULL-clear" is gibberish when the actual
> bug is just spurious clear of log->bios_event_log. Also we are not
> doing anything we are not computers.

I.e. in place of "we", use the name of the function and this should
be good. The fix itself is legit.

Br, Jarkko