fix possible overflow

This commit is contained in:
Doug MacEachern 2007-02-05 20:21:53 +00:00
parent 08d212ecf9
commit 1c8433cd7d
2 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@
((sigar_uint64_t)(s) * (sigar_uint64_t)SIGAR_NSEC)
/* cpu ticks to milliseconds */
#define SIGAR_TICK2MSEC(s) ((s) * (SIGAR_MSEC / sigar->ticks))
#define SIGAR_TICK2MSEC(s) ((sigar_uint64_t)(s) * ((sigar_uint64_t)SIGAR_MSEC / sigar->ticks))
#define SIGAR_TICK2NSEC(s) ((sigar_uint64_t)(s) * ((sigar_uint64_t)SIGAR_NSEC / sigar->ticks))
#define IFTYPE_LO 2

View File

@ -499,7 +499,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
#else
int status;
long cp_time[CPUSTATES];
unsigned long cp_time[CPUSTATES];
size_t size = sizeof(cp_time);
/* try sysctl first, does not require /dev/kmem perms */