commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 05/15: utils/vmstat: fix integer overflow


From: Samuel Thibault
Subject: [hurd] 05/15: utils/vmstat: fix integer overflow
Date: Sun, 05 Jul 2015 00:41:59 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 50da095243745f2e2a0c3f4805fe187a392832b7
Author: Justus Winter <address@hidden>
Date:   Sat May 23 12:06:35 2015 +0200

    utils/vmstat: fix integer overflow
    
    Previously, the `vmstat' utility would stop displaying the memory
    object hit ratio after some time due to an integer overflow.
    
    * utils/vmstat.c (get_memobj_hit_ratio): Fix integer overflow.
---
 utils/vmstat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils/vmstat.c b/utils/vmstat.c
index e394484..92a3672 100644
--- a/utils/vmstat.c
+++ b/utils/vmstat.c
@@ -242,7 +242,8 @@ vm_state_get_field (struct vm_state *state, const struct 
field *field)
 static val_t
 get_memobj_hit_ratio (struct vm_state *state, const struct field *field)
 {
-  return state->vmstats.hits * 100 / state->vmstats.lookups;
+  return (val_t)
+    ((float) state->vmstats.hits * 100. / (float) state->vmstats.lookups);
 }
 
 /* Makes sure STATE contains a default pager port and associated info, and

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]