summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunmi Ha <yunmi.ha@samsung.com>2021-02-22 11:37:15 +0900
committerYunmi Ha <yunmi.ha@samsung.com>2021-02-22 12:49:35 +0900
commit301a5752596cd6d2beb71b75dd7190969442abed (patch)
tree84085b6e525510560978c561c4dfabbc56e2a714
parent545eebd2921a6508e110b8af4368446e9b52fe12 (diff)
downloaddevice-rpi-301a5752596cd6d2beb71b75dd7190969442abed.tar.gz
device-rpi-301a5752596cd6d2beb71b75dd7190969442abed.tar.bz2
device-rpi-301a5752596cd6d2beb71b75dd7190969442abed.zip
Fix svace issues
- memory: DIVISION_BY_ZERO Change-Id: I17ff0853a48ff6c6c517e6bf97257fd8c02c7650 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 f121f91..ff9668e 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);