fix rga mmu buf cause system crash when use ion mmu buf
authorShengqin.Zhang <zsq@rock-chips.com>
Mon, 25 May 2015 07:30:20 +0000 (15:30 +0800)
committerShengqin.Zhang <zsq@rock-chips.com>
Mon, 25 May 2015 07:30:20 +0000 (15:30 +0800)
Signed-off-by: Shengqin.Zhang <zsq@rock-chips.com>
drivers/video/rockchip/rga2/rga2_mmu_info.c

index ca05a79d08c15550223e07ac78ebc623d925d5a2..0d90d539a470be29841a292e4d95365261e7e41a 100644 (file)
@@ -358,6 +358,7 @@ static int rga2_MapION(struct sg_table *sg,
     uint32_t len;\r
     struct scatterlist *sgl = sg->sgl;\r
     uint32_t sg_num = 0;\r
+    uint32_t break_flag = 0;\r
 \r
     status = 0;\r
     Address = 0;\r
@@ -366,9 +367,14 @@ static int rga2_MapION(struct sg_table *sg,
         Address = sg_phys(sgl);\r
 \r
         for(i=0; i<len; i++) {\r
+            if (mapped_size + i >= pageCount) {\r
+                break_flag = 1;\r
+                break;\r
+            }\r
             Memory[mapped_size + i] = (uint32_t)(Address + (i << PAGE_SHIFT));\r
         }\r
-\r
+        if (break_flag)\r
+            break;\r
         mapped_size += len;\r
         sg_num += 1;\r
     }\r