diff options
author | Chenyuan Mi <michenyuan@huawei.com> | 2023-07-25 09:24:07 +0000 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-07-29 15:59:20 +0100 |
commit | 49d736313d0975ddeb156f4f59801da833f78b30 (patch) | |
tree | 14fe4bad9cd8a98d7c024d91e872ec51c0e56e4f /drivers/iio | |
parent | 9afc8c6dc68f2f58c4ad7c7c72158e1a7bb5395e (diff) | |
download | linux-stable-49d736313d0975ddeb156f4f59801da833f78b30.tar.gz linux-stable-49d736313d0975ddeb156f4f59801da833f78b30.tar.bz2 linux-stable-49d736313d0975ddeb156f4f59801da833f78b30.zip |
tools: iio: iio_generic_buffer: Fix some integer type and calculation
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>
Diffstat (limited to 'drivers/iio')
0 files changed, 0 insertions, 0 deletions