aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-03-07 04:20:22 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-03-07 04:20:22 +0100
commit75e56a3db9c1415dac1a3d83a12f694930897a8c (patch)
tree0ab5fe0a7a3312e64bfb3a0d44fda40142318f2b
parent86107d6dc7b6a182e01fb8296cb4e1680963184d (diff)
downloadbusybox-75e56a3db9c1415dac1a3d83a12f694930897a8c.tar.gz
top: do unsigned rather than signed division in do_stats()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/top.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/procps/top.c b/procps/top.c
index 9bb3eed29..fc056621b 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -180,7 +180,7 @@ struct globals {
#else
cmp_funcp sort_function[SORT_DEPTH];
struct save_hist *prev_hist;
- int prev_hist_count;
+ unsigned prev_hist_count;
jiffy_counts_t cur_jif, prev_jif;
/* int hist_iterations; */
unsigned total_pcpu;
@@ -189,7 +189,7 @@ struct globals {
#if ENABLE_FEATURE_TOP_SMP_CPU
/* Per CPU samples: current and last */
jiffy_counts_t *cpu_jif, *cpu_prev_jif;
- int num_cpus;
+ unsigned num_cpus;
#endif
#if ENABLE_FEATURE_TOP_INTERACTIVE
char kbd_input[KEYCODE_BUFFER_SIZE];
@@ -355,7 +355,8 @@ static void do_stats(void)
{
top_status_t *cur;
pid_t pid;
- int i, last_i, n;
+ int n;
+ unsigned i, last_i;
struct save_hist *new_hist;
get_jiffy_counts();