kernel_samsung_a53x/tools/iio
Chenyuan Mi de60e39da9 tools: iio: iio_generic_buffer: Fix some integer type and calculation
[ Upstream commit 49d736313d0975ddeb156f4f59801da833f78b30 ]

In function size_from_channelarray(), the return value 'bytes' is defined
as int type. However, the calcution of 'bytes' in this function is designed
to use the unsigned int type. So it is necessary to change 'bytes' type to
unsigned int to avoid integer overflow.

The size_from_channelarray() is called in main() function, its return value
is directly multipled by 'buf_len' and then used as the malloc() parameter.
The 'buf_len' is completely controllable by user, thus a multiplication
overflow may occur here. This could allocate an unexpected small area.

Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
Link: https://lore.kernel.org/r/20230725092407.62545-1-michenyuan@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stable-dep-of: 2d3dff577dd0 ("tools: iio: iio_generic_buffer ensure alignment")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 11:43:05 +01:00
..
Build Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iio_event_monitor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iio_generic_buffer.c tools: iio: iio_generic_buffer: Fix some integer type and calculation 2024-11-18 11:43:05 +01:00
iio_utils.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iio_utils.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lsiio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00