util: kernel: Fix overflow issue when multiply operation 95/272295/1 accepted/tizen/unified/20220315.065607 submit/tizen/20220315.010333
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 14 Mar 2022 07:46:05 +0000 (16:46 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 14 Mar 2022 07:46:05 +0000 (16:46 +0900)
Change-Id: Ia9bce7fbc4adabafa76e788d78450ce38866d7cf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/util/kernel.c

index a68e05b..b01594b 100644 (file)
@@ -184,7 +184,7 @@ int kernel_get_memory_info(const char *key, u_int64_t *val)
                if (!strncmp(buf, key, strlen(key))) {
                        sscanf(buf, "%*s %"PRIu64, val);
                        if (strstr(buf, "kB"))
-                               *val *= 1024;
+                               *val = (u_int64_t)(*val * 1024);
                        break;
                }
        }