Commit bad6e139 authored by Paul E. McKenney's avatar Paul E. McKenney

rcu: get rid of signed overflow in check_cpu_stall()

Signed integer overflow is undefined by the C standard, so move
calculations to unsigned.
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent b554d7de
...@@ -581,21 +581,24 @@ static void print_cpu_stall(struct rcu_state *rsp) ...@@ -581,21 +581,24 @@ static void print_cpu_stall(struct rcu_state *rsp)
static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp) static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
{ {
long delta; unsigned long j;
unsigned long js;
struct rcu_node *rnp; struct rcu_node *rnp;
if (rcu_cpu_stall_suppress) if (rcu_cpu_stall_suppress)
return; return;
delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall); j = ACCESS_ONCE(jiffies);
js = ACCESS_ONCE(rsp->jiffies_stall);
rnp = rdp->mynode; rnp = rdp->mynode;
if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) { if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && ULONG_CMP_GE(j, js)) {
/* We haven't checked in, so go dump stack. */ /* We haven't checked in, so go dump stack. */
print_cpu_stall(rsp); print_cpu_stall(rsp);
} else if (rcu_gp_in_progress(rsp) && delta >= RCU_STALL_RAT_DELAY) { } else if (rcu_gp_in_progress(rsp) &&
ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY)) {
/* They had two time units to dump stack, so complain. */ /* They had a few time units to dump stack, so complain. */
print_other_cpu_stall(rsp); print_other_cpu_stall(rsp);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment