@@ -669,7 +669,9 @@ static int crb_acpi_add(struct acpi_device *device)
status = acpi_get_table(ACPI_SIG_TPM2, 1,
(struct acpi_table_header **) &buf);
- if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
+ if (ACPI_FAILURE(status) || buf->header.length <
+ offsetof(struct acpi_table_tpm2,
+ start_method_specific)) {
dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
return -EINVAL;
}
@@ -684,14 +686,19 @@ static int crb_acpi_add(struct acpi_device *device)
return -ENOMEM;
if (sm == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC) {
- if (buf->header.length < (sizeof(*buf) + sizeof(*crb_smc))) {
+ if (buf->header.length <
+ (offsetof(struct acpi_table_tpm2,
+ start_method_specific) +
+ sizeof(*crb_smc))) {
dev_err(dev,
FW_BUG "TPM2 ACPI table has wrong size %u for start method type %d\n",
buf->header.length,
ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC);
return -EINVAL;
}
- crb_smc = ACPI_ADD_PTR(struct tpm2_crb_smc, buf, sizeof(*buf));
+ crb_smc = ACPI_ADD_PTR(struct tpm2_crb_smc, buf,
+ offsetof(struct acpi_table_tpm2,
+ start_method_specific));
priv->smc_func_id = crb_smc->smc_func_id;
}
@@ -111,7 +111,9 @@ static int check_acpi_tpm2(struct device *dev)
*/
st =
acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl);
- if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
+ if (ACPI_FAILURE(st) || tbl->header.length <
+ offsetof(struct acpi_table_tpm2,
+ start_method_specific)) {
dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
return -EINVAL;
}
@@ -411,8 +411,9 @@ struct acpi_table_tpm2 {
u16 reserved;
u64 control_address;
u32 start_method;
-
- /* Platform-specific data follows */
+ u8 start_method_specific[12];
+ u32 log_area_minimum_length; /* optional */
+ u64 log_area_start_address; /* optional */
};
/* Values for start_method above */