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>
Sun, 20 Feb 2022 23:22:07 +0000 (00:22 +0100)
commit5454594988d8d49317a3ce33033bb10221f30e27
treee257ef4534a730a393ed80f28e1fdfb5f5279a50
parent1ac843521242b7a0f8090c0f2100d04869355b04
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