hwspinlock: sprd: Use struct_size() helper in devm_kzalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 25 Jan 2022 22:57:23 +0000 (16:57 -0600)
committerGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 14 Feb 2022 20:37:29 +0000 (14:37 -0600)
commit04c36bd452de83024ce58f34e22d6df863615d58
treecc3942f6539054cd9b6accdc65a355f0bb4b6e57
parent26291c54e111ff6ba87a164d85d4a4e134b7315c
hwspinlock: sprd: 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 or integer overflows that,
in the worst scenario, could lead to heap overflows.

Also, address the following sparse warnings:
drivers/hwspinlock/sprd_hwspinlock.c:96:36: warning: using sizeof on a flexible structure

Link: https://github.com/KSPP/linux/issues/174
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
drivers/hwspinlock/sprd_hwspinlock.c