summaryrefslogtreecommitdiff
path: root/include/linux/tpm_buf.h
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@opinsys.com>2026-07-11 09:01:09 -0700
committerJarkko Sakkinen <jarkko@kernel.org>2026-08-21 04:44:57 +0300
commit24483231da259974d1a4cb041bb4adafc22d152d (patch)
tree6afcf981f75c78fc7794f83a9c17f0390fb089da /include/linux/tpm_buf.h
parent9d63c22a68b539869f4e43b9dcd76d5d1969bfe6 (diff)
downloadlinux-next-24483231da259974d1a4cb041bb4adafc22d152d.tar.gz
linux-next-24483231da259974d1a4cb041bb4adafc22d152d.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 'include/linux/tpm_buf.h')
0 files changed, 0 insertions, 0 deletions