libsparse: Fix odd-sized input files total_blks
If the input file isn't a multiple of block_size, count the trailing bit as a block in the output, otherwise bootloader will try to write past the last declared block in the sparse file. Test: Run sparse_test Bug: 37339998 Change-Id: Iec143107d15795c6a6f4d3ea7b7515f6f16adcae
This commit is contained in:
parent
8b318d0c26
commit
3738968ed8
|
@ -584,7 +584,7 @@ static int output_file_init(struct output_file *out, int block_size,
|
|||
.file_hdr_sz = SPARSE_HEADER_LEN,
|
||||
.chunk_hdr_sz = CHUNK_HEADER_LEN,
|
||||
.blk_sz = out->block_size,
|
||||
.total_blks = out->len / out->block_size,
|
||||
.total_blks = DIV_ROUND_UP(out->len, out->block_size),
|
||||
.total_chunks = chunks,
|
||||
.image_checksum = 0
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue