]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx8mn: buffer overflow in low_drive_gpu_freq()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 17 Apr 2023 23:37:21 +0000 (01:37 +0200)
committerStefano Babic <sbabic@denx.de>
Tue, 2 May 2023 08:57:32 +0000 (10:57 +0200)
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@canonical.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8m/soc.c

index df865e997d384c13307c75123230764d5c48f175..20672ded9616d7f0806afb4815a694bd29f04f52 100644 (file)
@@ -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;