ipq: Add check to avoid overwriting successive partitions

This change adds a check to detect if the size of image to be flashed
fits within the respective partition region.

Change-Id: I794262fa759eef4ecc726252fb3d234c087f2b4d
Signed-off-by: Pavithra Palanisamy <pavip@codeaurora.org>
This commit is contained in:
Pavithra Palanisamy 2019-04-30 15:51:39 +05:30
parent 241e5e86b0
commit 4bb8ae0f50

View file

@ -270,6 +270,12 @@ char * const argv[])
} }
if (flash_cmd) { if (flash_cmd) {
if (file_size > part_size) {
printf("Image size is greater than partition memory\n");
return CMD_RET_FAILURE;
}
if (flash_type == SMEM_BOOT_NAND_FLASH) { if (flash_type == SMEM_BOOT_NAND_FLASH) {
adj_size = file_size % nand->writesize; adj_size = file_size % nand->writesize;