From 214b55a2594c9c1474f34e2bc0a020e6f6d82b47 Mon Sep 17 00:00:00 2001 From: Lan Zou Date: Fri, 27 Apr 2018 19:20:21 +0800 Subject: [PATCH] drm/msm/sde: fix array overflow Array ilm_pair_mask may use index larger than its size. This change can avoid the risk happens. Change-Id: I18b2ae814aa19e6c76884bbe71cdd9ea659ce05a Signed-off-by: Lan Zou --- drivers/gpu/drm/msm/sde/sde_hw_catalog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/sde/sde_hw_catalog.c b/drivers/gpu/drm/msm/sde/sde_hw_catalog.c index ed9a6ea37397..9e0bf09bff0a 100644 --- a/drivers/gpu/drm/msm/sde/sde_hw_catalog.c +++ b/drivers/gpu/drm/msm/sde/sde_hw_catalog.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1205,7 +1205,7 @@ static int sde_mixer_parse_dt(struct device_node *np, if (!prop_exists[MIXER_LEN]) mixer->len = DEFAULT_SDE_HW_BLOCK_LEN; - if (lm_pair_mask[i]) + if ((i < ARRAY_SIZE(lm_pair_mask)) && lm_pair_mask[i]) mixer->lm_pair_mask = 1 << lm_pair_mask[i]; sblk->maxblendstages = max_blendstages;