RDMA/hfi1: Use struct_size() and flex_array_size() helpers
authorGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 27 Sep 2021 22:53:33 +0000 (17:53 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 27 Sep 2021 23:15:54 +0000 (20:15 -0300)
commit11333be19c08b9277a87eb8c163217b8c362e91e
treec60c0ba3c1369fea82e5b5ecc63671b06a1b4822
parent6d1ebccbd64af1f989c1e8a5976f82282ddd4ee4
RDMA/hfi1: Use struct_size() and flex_array_size() helpers

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

Link: https://lore.kernel.org/r/20210927225333.GA192634@embeddedor
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/user_exp_rcv.c