]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm/a6xx: fix a potential overflow issue
authorZhenzhong Duan <zhenzhong.duan@gmail.com>
Sat, 12 Sep 2020 10:25:58 +0000 (18:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:25 +0000 (10:08 +0100)
[ Upstream commit 08d3ab4b46339bc6f97e83b54a3fb4f8bf8f4cd9 ]

It's allocating an array of a6xx_gpu_state_obj structure rathor than
its pointers.

This patch fix it.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c

index d6023ba8033c053b168edac484f7cc92db71d4ca..3bb567812b9902bc33ac098d8fdc560c648820ea 100644 (file)
@@ -864,7 +864,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
        int i;
 
        a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
-               sizeof(a6xx_state->indexed_regs));
+               sizeof(*a6xx_state->indexed_regs));
        if (!a6xx_state->indexed_regs)
                return;