Skip to content
Commit 2d255ec5 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jonathan Cameron
Browse files

iio: hw_consumer: Use struct_size() helper in 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/iio/buffer/industrialio-hw-consumer.c:63:23: warning: using sizeof on a flexible structure when using CF='-Wflexible-array-sizeof'

Link: https://github.com/KSPP/linux/issues/174


Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220120225243.GA37225@embeddedor


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c39010ea
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment