When compiling for R5 core with CONFIG_REMOTEPROC_TI_K3_R5F,
passing 'size' (ulong) to ti_secure_image_post_process() caused
a type mismatch compiler error.
On platforms where ulong and size_t differ in size, directly
casting could lead to out-of-bounds memory access. Fix by
introducing a size_t temporary variable, passing it to the
function, and writing back the potentially modified value for
use in subsequent calls.
Signed-off-by: Philippe Schenker <philippe.schenker@impulsing.ch>
Acked-by: Andrew Davis <afd@ti.com>
bool mem_auto_init;
void *image_addr = (void *)addr;
int ret;
+ size_t size_img;
dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size);
k3_r5f_init_tcm_memories(core, mem_auto_init);
- ti_secure_image_post_process(&image_addr, &size);
+ size_img = size;
+ ti_secure_image_post_process(&image_addr, &size_img);
+ size = size_img;
ret = rproc_elf_load_image(dev, addr, size);
if (ret < 0) {