fastboot: Fix overflow when calculating chunk size
authorSean Anderson <sean.anderson@seco.com>
Thu, 27 May 2021 16:02:34 +0000 (12:02 -0400)
committerHan Gao <gaohan@iscas.ac.cn>
Wed, 18 Oct 2023 16:15:40 +0000 (00:15 +0800)
commita9ee7466870cbc97155f19293edda82026aab6b7
tree10e01bcdf560a58b8c9aac68b643f7afdb8e56c8
parent8640db84b84b06c39f2e45e140c87ed8e74b80aa
fastboot: Fix overflow when calculating chunk size

If a chunk was larger than 4GiB, then chunk_data_sz would overflow and
blkcnt would not be calculated correctly. Upgrade it to a u64 and cast
its multiplicands as well. Also fix bytes_written while we're at it.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
lib/image-sparse.c