[COMMON] iommu/exynos: check condition before pointer access
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Mon, 5 Sep 2016 03:21:20 +0000 (12:21 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:20 +0000 (19:45 +0900)
Fix Svace : 64214, 64219

Change-Id: I5ab4d2e84d4a510693978b6aac97ebf8c037119e
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
drivers/iommu/exynos-iommu.c

index 6816d48c830fbde213bf555d2b16f1d0fe3fc1a4..335068108c349f505c15b70fee34c01e5d825e00 100644 (file)
@@ -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;