tpm: xen-tpmfront: Use struct_size() helper
authorGustavo A. R. Silva <gustavoars@kernel.org>
Wed, 19 Jan 2022 23:38:03 +0000 (17:38 -0600)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 8 Mar 2022 08:33:18 +0000 (10:33 +0200)
commit2dd634664d4128668c44bc9e497af24157f1eef4
tree9945378cda1bf9fc68321d664f461d93b9b95068
parent8bdc3e05cc78513b7495366ef9b962a3ea568e8e
tpm: xen-tpmfront: Use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows that,
in the worse scenario, could lead to heap overflows.

Also, address the following sparse warning:
drivers/char/tpm/xen-tpmfront.c:131:16: warning: using sizeof on a flexible structure

Link: https://github.com/KSPP/linux/issues/160
Link: https://github.com/KSPP/linux/issues/174
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/xen-tpmfront.c