[PATCH 1/1] imx8mn: buffer overflow in low_drive_gpu_freq()

Peng Fan peng.fan at oss.nxp.com
Tue Apr 18 07:26:58 CEST 2023



On 4/18/2023 7:37 AM, Heinrich Schuchardt wrote:
> Avoid a buffer overflow if assigned-clock-rates has less than two elements.
> 
> Fixes: 98bcdf16356c ("imx8mn: Add low drive mode support for DDR4/LPDDR4 EVK")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>

Reviewed-by: Peng Fan <peng.fan at nxp.com>

> ---
>   arch/arm/mach-imx/imx8m/soc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> index df865e997d..20672ded96 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -914,6 +914,8 @@ static int low_drive_gpu_freq(void *blob)
>   
>   	if (cnt != 7)
>   		printf("Warning: %s, assigned-clock-rates count %d\n", nodes_path_8mn[0], cnt);
> +	if (cnt < 2)
> +		return -1;
>   
>   	assignedclks[cnt - 1] = 200000000;
>   	assignedclks[cnt - 2] = 200000000;


More information about the U-Boot mailing list