Commit b6f91ab6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tpmdd-next-20200522' of git://git.infradead.org/users/jjs/linux-tpmdd

Pull tpm updates from Jarkko Sakkinen.

* tag 'tpmdd-next-20200522' of git://git.infradead.org/users/jjs/linux-tpmdd:
  tpm: eventlog: Replace zero-length array with flexible-array member
  tpm/tpm_ftpm_tee: Use UUID API for exporting the UUID
parents 3d77e6a8 ab91c2a8
...@@ -51,8 +51,7 @@ static void *tpm2_bios_measurements_start(struct seq_file *m, loff_t *pos) ...@@ -51,8 +51,7 @@ static void *tpm2_bios_measurements_start(struct seq_file *m, loff_t *pos)
int i; int i;
event_header = addr; event_header = addr;
size = sizeof(struct tcg_pcr_event) - sizeof(event_header->event) size = struct_size(event_header, event, event_header->event_size);
+ event_header->event_size;
if (*pos == 0) { if (*pos == 0) {
if (addr + size < limit) { if (addr + size < limit) {
...@@ -98,8 +97,8 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v, ...@@ -98,8 +97,8 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
event_header = log->bios_event_log; event_header = log->bios_event_log;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
event_size = sizeof(struct tcg_pcr_event) - event_size = struct_size(event_header, event,
sizeof(event_header->event) + event_header->event_size; event_header->event_size);
marker = event_header; marker = event_header;
} else { } else {
event = v; event = v;
...@@ -136,9 +135,8 @@ static int tpm2_binary_bios_measurements_show(struct seq_file *m, void *v) ...@@ -136,9 +135,8 @@ static int tpm2_binary_bios_measurements_show(struct seq_file *m, void *v)
size_t size; size_t size;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
size = sizeof(struct tcg_pcr_event) - size = struct_size(event_header, event,
sizeof(event_header->event) + event_header->event_size; event_header->event_size);
temp_ptr = event_header; temp_ptr = event_header;
if (size > 0) if (size > 0)
......
...@@ -241,7 +241,7 @@ static int ftpm_tee_probe(struct platform_device *pdev) ...@@ -241,7 +241,7 @@ static int ftpm_tee_probe(struct platform_device *pdev)
/* Open a session with fTPM TA */ /* Open a session with fTPM TA */
memset(&sess_arg, 0, sizeof(sess_arg)); memset(&sess_arg, 0, sizeof(sess_arg));
memcpy(sess_arg.uuid, ftpm_ta_uuid.b, TEE_IOCTL_UUID_LEN); export_uuid(sess_arg.uuid, &ftpm_ta_uuid);
sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC; sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
sess_arg.num_params = 0; sess_arg.num_params = 0;
......
...@@ -97,7 +97,7 @@ struct tcg_pcr_event { ...@@ -97,7 +97,7 @@ struct tcg_pcr_event {
u32 event_type; u32 event_type;
u8 digest[20]; u8 digest[20];
u32 event_size; u32 event_size;
u8 event[0]; u8 event[];
} __packed; } __packed;
struct tcg_event_field { struct tcg_event_field {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment