summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-04-18 01:37:21 +0200
committerStefano Babic <sbabic@denx.de>2023-05-02 10:57:32 +0200
commit76ce66408dfccb491114d721260717ae76795b4d (patch)
tree625b7bc2dff9e8dcd8f6dd08817566b4da410ec5 /arch
parentb016fcf723c976ff50c4d4b0848c89cb06158c57 (diff)
downloadu-boot-76ce66408dfccb491114d721260717ae76795b4d.tar.gz
imx8mn: buffer overflow in low_drive_gpu_freq()
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/imx8m/soc.c2
1 files changed, 2 insertions, 0 deletions
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;