[PATCH] drm/msm/a6xx: Fix missing ARRAY_SIZE() check

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Fri Mar 4 21:47:15 UTC 2022


On Fri, 4 Mar 2022 at 23:23, Rob Clark <robdclark at gmail.com> wrote:
>
> From: Rob Clark <robdclark at chromium.org>
>
> Fixes: f6d62d091cfd ("drm/msm/a6xx: add support for Adreno 660 GPU")
> Signed-off-by: Rob Clark <robdclark at chromium.org>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
However see the comment below.

> ---
>  drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index 02b47977b5c3..6406d8c3411a 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -687,6 +687,7 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
>
>         BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
>         BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
> +       BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);

The magic number 32 and 48 are repeated through this code. I'd suggest
to define them and use defined names.
It can come up as a separate commit.

>         if (adreno_is_a650(adreno_gpu)) {
>                 regs = a650_protect;
> --
> 2.35.1
>


-- 
With best wishes
Dmitry


More information about the dri-devel mailing list