Files
Jarkko Sakkinen 3d9e043dab tpm-buf: Memory-safe allocations
Decouple kzalloc from buffer creation, so that a managed allocation can be
used:

	struct tpm_buf *buf __free(kfree) buf = kzalloc(TPM_BUFSIZE,
						GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	tpm_buf_init(buf, TPM_BUFSIZE);

Alternatively, other allocations are also possible (static data, stack,
etc) for example:

	u8 buf_data[512];
	struct tpm_buf *buf = (struct tpm_buf *)buf_data;
	tpm_buf_init(buf, sizeof(buf_data));

This is achieved by embedding buffer's header inside the allocated blob,
instead of having an outer wrapper.

Reviewed-by: Stefan Berger <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
Tested-by: Srish Srinivasan <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Ross Philipson <[email protected]>
2026-08-25 18:13:36 +03:00
..
…
2023-02-13 18:34:48 +08:00
2025-06-11 11:57:14 -07:00
…
2025-11-04 12:36:02 +01:00