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)
committerGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 14 Feb 2022 20:40:32 +0000 (14:40 -0600)
commiteb29c492def3b40a93258ecafce3582f9c048e82
tree2bbfa3180695899e076565393c3874d23f3b2407
parent04c36bd452de83024ce58f34e22d6df863615d58
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
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
drivers/char/tpm/xen-tpmfront.c