summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunmi Ha <yunmi.ha@samsung.com>2021-02-22 11:33:17 +0900
committerYunmi Ha <yunmi.ha@samsung.com>2021-02-22 12:46:42 +0900
commitb0767df4a3649ccea9345243f3b5b39eb94cd529 (patch)
treeeca5ab995f1362244d272088ad2b34e559e1489c
parentce9f2e107654bb95856545da6e89f0fd3b8a0787 (diff)
downloaddevice-tw3-b0767df4a3649ccea9345243f3b5b39eb94cd529.tar.gz
device-tw3-b0767df4a3649ccea9345243f3b5b39eb94cd529.tar.bz2
device-tw3-b0767df4a3649ccea9345243f3b5b39eb94cd529.zip
Fix svace issues
- memory: DIVISION_BY_ZERO Change-Id: I5f0423807ab0c5a028e8d3300f39bc29a019779c Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
-rw-r--r--hw/memory/memory.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/memory/memory.c b/hw/memory/memory.c
index bf99967..1f2eb5d 100644
--- a/hw/memory/memory.c
+++ b/hw/memory/memory.c
@@ -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);