projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9dbdc6e
)
fastboot: sparse: fix sparse blocks calculation
author
Jeffy Chen
<jeffy.chen@rock-chips.com>
Wed, 3 Feb 2016 10:13:55 +0000
(18:13 +0800)
committer
Tom Rini
<trini@konsulko.com>
Mon, 11 Apr 2016 16:44:37 +0000
(12:44 -0400)
It may overflow in sparse_block_size_to_storage, use uint64_t instead in
the calculation.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
common/image-sparse.c
patch
|
blob
|
history
diff --git
a/common/image-sparse.c
b/common/image-sparse.c
index dffe844d548a81d9751991f53ba2da77f8142571..2433192b20ef019198483e03f14866dc6340f2d3 100644
(file)
--- a/
common/image-sparse.c
+++ b/
common/image-sparse.c
@@
-64,7
+64,8
@@
static unsigned int sparse_block_size_to_storage(unsigned int size,
sparse_storage_t *storage,
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)