tpm: fix byte order related arithmetic inconsistency in tpm_getcap()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Sun, 7 May 2017 17:50:02 +0000 (20:50 +0300)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 13 Jun 2017 19:02:08 +0000 (22:02 +0300)
commit124bdcf4a697f9672d1150de60c5ea489bcad201
treeeb47aa20575a6a603bc5f80394178e990e5c23cc
parentd8c3eab5cb92f37ca8576fc641fa4bfd8a0c8b00
tpm: fix byte order related arithmetic inconsistency in tpm_getcap()

You should not do arithmetic with __be32 or __le32 types because
sometimes it results incorrect results. Calculations must be done only
with integers that are in in the CPU byte order. This commit migrates
tpm_getcap() to struct tpm_buf in order to sort out these issues.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm.h