Skip to content

Commit 720b071

Browse files
author
Jarkko Sakkinen
committed
tpm: access command header through struct in tpm_try_transmit()
Instead of accessing fields of the command header through offsets to the raw buffer, it is a better idea to use the header struct pointer that is already used elsewhere in the function. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Tested-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com> Tested-by: Alexander Steffen <Alexander.Steffen@infineon.com>
1 parent b34b77a commit 720b071

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/tpm/tpm-interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, struct tpm_space *space,
187187
if (bufsiz > TPM_BUFSIZE)
188188
bufsiz = TPM_BUFSIZE;
189189

190-
count = be32_to_cpu(*((__be32 *) (buf + 2)));
191-
ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
190+
count = be32_to_cpu(header->length);
191+
ordinal = be32_to_cpu(header->ordinal);
192192
if (count == 0)
193193
return -ENODATA;
194194
if (count > bufsiz) {

0 commit comments

Comments
 (0)