diff options
| author | Jarkko Sakkinen <jarkko.sakkinen@opinsys.com> | 2026-07-11 09:01:09 -0700 |
|---|---|---|
| committer | Jarkko Sakkinen <jarkko@kernel.org> | 2026-08-25 18:13:36 +0300 |
| commit | 3d9e043dab0a038a53a43570f60bbf4b1e27d63f (patch) | |
| tree | 6c4695385c26728565510e7c60b5896e53715452 /scripts/objdiff | |
| parent | 065cfba1f4545e5948a2ddc5888a27c7641d5bfc (diff) | |
| download | linux-next-3d9e043dab0a038a53a43570f60bbf4b1e27d63f.tar.gz linux-next-3d9e043dab0a038a53a43570f60bbf4b1e27d63f.zip | |
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 <stefanb@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@opinsys.com>
Tested-by: Srish Srinivasan <ssrish@linux.ibm.com>
Message-ID: <20260522013555.1063716-1-jarkko@kernel.org>
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions
