ASoC: wcd_cpe_core: add size check for WDSP ELF files

Add size check to make sure the data sizes from WDSP
ELF metadata and the split firmware ELF are the same.

Change-Id: Ic2f7dc04dfc95608302cba23461c519378619db0
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
This commit is contained in:
Xiaoyu Ye 2018-01-15 16:10:30 -08:00 committed by syphyr
parent d6119a65a9
commit 60cf32f480
1 changed files with 8 additions and 0 deletions

View File

@ -335,6 +335,14 @@ static int wcd_cpe_load_each_segment(struct wcd_cpe_core *core,
goto done;
}
if (phdr->p_filesz != split_fw->size) {
dev_err(core->dev,
"%s: %s size mismatch, phdr_size: 0x%x fw_size: 0x%zx",
__func__, split_fname, phdr->p_filesz, split_fw->size);
ret = -EINVAL;
goto done;
}
segment->cpe_addr = phdr->p_paddr;
segment->size = phdr->p_filesz;
segment->data = (u8 *) split_fw->data;