← Commit list

75e56a3db

Denys Vlasenko
Denys Vlasenko
2018-03-07
SUCCESS Duration: 144s

Subject

top: do unsigned rather than signed division in do_stats()

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/top.c+4 -3
@@ -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();