NTB: Use struct_size() helper in devm_kzalloc()

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
variable _struct_size_.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>

authored by Gustavo A. R. Silva and committed by Jon Mason b8e2c8bb dbb8df5c

+1 -4
+1 -4
drivers/ntb/test/ntb_msi_test.c
··· 319 319 static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb) 320 320 { 321 321 struct ntb_msit_ctx *nm; 322 - size_t struct_size; 323 322 int peers; 324 323 int ret; 325 324 ··· 351 352 return ret; 352 353 } 353 354 354 - struct_size = sizeof(*nm) + sizeof(*nm->peers) * peers; 355 - 356 - nm = devm_kzalloc(&ntb->dev, struct_size, GFP_KERNEL); 355 + nm = devm_kzalloc(&ntb->dev, struct_size(nm, peers, peers), GFP_KERNEL); 357 356 if (!nm) 358 357 return -ENOMEM; 359 358