Skip to content
Snippets Groups Projects
Commit d3bafe32 authored by Jeffy Chen's avatar Jeffy Chen Committed by Tom Rini
Browse files

fastboot: sparse: fix sparse blocks calculation


It may overflow in sparse_block_size_to_storage, use uint64_t instead in
the calculation.

Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
parent 9dbdc6eb
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,8 @@ static unsigned int sparse_block_size_to_storage(unsigned int size, ...@@ -64,7 +64,8 @@ static unsigned int sparse_block_size_to_storage(unsigned int size,
sparse_storage_t *storage, sparse_storage_t *storage,
sparse_header_t *sparse) sparse_header_t *sparse)
{ {
return size * sparse->blk_sz / storage->block_sz; return (unsigned int)lldiv((uint64_t)size * sparse->blk_sz,
storage->block_sz);
} }
static bool sparse_chunk_has_buffer(chunk_header_t *chunk) static bool sparse_chunk_has_buffer(chunk_header_t *chunk)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment