From 99f2e2e54cd12c1f3a51feb12b14e57486946891 Mon Sep 17 00:00:00 2001 From: Janghyuck Kim Date: Mon, 5 Sep 2016 12:21:20 +0900 Subject: [PATCH] [COMMON] iommu/exynos: check condition before pointer access Fix Svace : 64214, 64219 Change-Id: I5ab4d2e84d4a510693978b6aac97ebf8c037119e Signed-off-by: Janghyuck Kim --- drivers/iommu/exynos-iommu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 6816d48c830f..335068108c34 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -644,6 +644,8 @@ static int __init sysmmu_parse_dt(struct device *sysmmu, switch (prop & WAY_TYPE_MASK) { case _PRIVATE_WAY_ID: + BUG_ON(!priv_id_cfg || priv_id_idx >= priv_id_cnt); + priv_id_cfg[priv_id_idx].cfg = prop & ~WAY_TYPE_MASK; ret = of_property_read_u32_index(sysmmu->of_node, props_name, i+1, &priv_id_cfg[priv_id_idx].id); @@ -655,6 +657,8 @@ static int __init sysmmu_parse_dt(struct device *sysmmu, priv_id_idx++; break; case _PRIVATE_WAY_ADDR: + BUG_ON(!priv_addr_cfg || priv_addr_idx >= priv_addr_cnt); + priv_addr_cfg[priv_addr_idx].cfg = prop & ~WAY_TYPE_MASK; priv_addr_idx++; break; -- 2.20.1