mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-18 18:56:37 +00:00
firmware-utils: mkmylofw: fix blocks padding
The old code didn't make sense as it was using "len" variable which was
guaranteed to be always 0. Loop right above broken code is:
while (len > 0) { }
With this recent ALIGN macro fix this resulted in subtracting block size
from 0 and calling write_out_padding() with a negative length.
To calculate amount of bytes needed for padding & alignment it should be
enough to use % 4.
Fixes: a2f6622945
("firmware-utils: fix few random warnings")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
489aa752d7
commit
d4f2c2914a
@ -583,7 +583,7 @@ write_out_file(FILE *outfile, struct fw_block *block, uint32_t *crc)
|
||||
fclose(f);
|
||||
|
||||
/* align next block on a 4 byte boundary */
|
||||
len = ALIGN(len,4) - block->size;
|
||||
len = block->size % 4;
|
||||
if (write_out_padding(outfile, len, 0xFF, crc))
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user