[PATCH v1 2/6] remoteproc: k3-r5: cast size to size_t

Andrew Davis afd at ti.com
Thu Oct 23 16:22:28 CEST 2025


On 10/23/25 4:46 AM, Philippe Schenker wrote:
> From: Philippe Schenker <philippe.schenker at impulsing.ch>
> 
> 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.
> 

size_t and ulong should both be 32bit on any reasonable 32bit machine,
odd the compiler would complain here.

Casting pointers always worries me anyway, if the var being cast is
smaller then you will read out of bounds, if the var is larger than
what it is cast to then you run into endianness issues. Always safer
to dereference into a temp variable of the correct type and pass a
pointer to that.

For this, probably fine either way,

Acked-by: Andrew Davis <afd at ti.com>

> Cast 'size' to (size_t *) to fix it.
> 
> Signed-off-by: Philippe Schenker <philippe.schenker at impulsing.ch>
> ---
> 
>   drivers/remoteproc/ti_k3_r5f_rproc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c
> index 48401bc6eb67..9d591aada276 100644
> --- a/drivers/remoteproc/ti_k3_r5f_rproc.c
> +++ b/drivers/remoteproc/ti_k3_r5f_rproc.c
> @@ -341,7 +341,7 @@ static int k3_r5f_load(struct udevice *dev, ulong addr, ulong size)
>   
>   	k3_r5f_init_tcm_memories(core, mem_auto_init);
>   
> -	ti_secure_image_post_process(&image_addr, &size);
> +	ti_secure_image_post_process(&image_addr, (size_t *)&size);
>   
>   	ret = rproc_elf_load_image(dev, addr, size);
>   	if (ret < 0) {



More information about the U-Boot mailing list