Fix svace issues
authorYunmi Ha <yunmi.ha@samsung.com>
Mon, 22 Feb 2021 02:37:15 +0000 (11:37 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Mon, 22 Feb 2021 03:49:35 +0000 (12:49 +0900)
 - memory: DIVISION_BY_ZERO

Change-Id: I17ff0853a48ff6c6c517e6bf97257fd8c02c7650
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
hw/memory/memory.c

index f121f91eb0d2befa318ee3abf2085aaa0298af93..ff9668e45b4cf6ff5f6c6be9a3d4ca02b385075b 100644 (file)
@@ -72,8 +72,11 @@ static int memory_get_gem_info(const int pid, struct gem_info *info)
        temp = total_rss / (unsigned long)BYTES_PER_KBYTE;
        info->rss = (int)temp;
 
-       temp = (total_rss / (unsigned long)total_hcount) / (unsigned long)BYTES_PER_KBYTE;
-       info->pss = (int)temp;
+       if (total_hcount > 0) {
+               temp = (total_rss / (unsigned long)total_hcount) / (unsigned long)BYTES_PER_KBYTE;
+               info->pss = (int)temp;
+       } else
+               info->pss = 0;
 
        fclose(fp);