]> git.baikalelectronics.ru Git - kernel.git/commit
Drivers: hv: vmbus: Use struct_size() helper in kmalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 25 Jan 2022 18:01:31 +0000 (12:01 -0600)
committerWei Liu <wei.liu@kernel.org>
Thu, 3 Feb 2022 12:42:31 +0000 (12:42 +0000)
commita84141621e5b8d20dc09b5e33b46a710353ba1d2
treedfd3bde551197392f32a9c887a693977f310cb34
parent2c38746ca2402e938b028d171c771f4caa588787
Drivers: hv: vmbus: Use struct_size() helper in kmalloc()

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 worst scenario, could lead to heap overflows.

Also, address the following sparse warnings:
drivers/hv/vmbus_drv.c:1132:31: warning: using sizeof on a flexible structure

Link: https://github.com/KSPP/linux/issues/174
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20220125180131.GA67746@embeddedor
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/vmbus_drv.c