[PATCH v3] tpm: Repeal and replace tpm_buf_init*() and tpm_buf_destroy()
Jarkko Sakkinen
jarkko at kernel.org
Tue Jul 1 00:26:50 UTC 2025
On Tue, Jul 01, 2025 at 03:11:51AM +0300, Jarkko Sakkinen wrote:
> From: Jarkko Sakkinen <jarkko.sakkinen at opinsys.com>
>
> Repeal and replace tpm_buf_init() and tpm_buf_init_sized() with
> tpm_buf_alloc(), which returns PAGE_SIZE of memory with the struct tpm_buf
> header in the beginning of the returned buffer. This leaves 4088 bytes of
> free space for data.
A minor error: it is now 4090 bytes:
struct tpm_buf {
u16 flags;
u16 length;
u16 handles;
u8 data[];
};
I guess this should be changed into:
struct tpm_buf {
u8 flags;
u8 handles;
u16 length;
u8 data[];
}
It's not strictly necessary given that we are already "above the
hardware spec" but it neither makes much sense to keep `handles`
or `flags` 16-bit words with MSB always empty in both of the
words.
BR, Jarkko
More information about the Linux-security-module-archive
mailing list