diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-05-03 02:40:04 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-05-06 02:16:59 -0400 |
commit | bad6e1393cb505fe17747344a23666464daa3fa7 (patch) | |
tree | 521dcada78d0f19400d14547381f0f3b2e38fea2 | |
parent | b554d7de8d112fca4188da3bf0d7f8b56f42fb95 (diff) |
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: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | kernel/rcutree.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 78923a50cdb2..b2fe2a273df2 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -581,21 +581,24 @@ static void print_cpu_stall(struct rcu_state *rsp) | |||
581 | 581 | ||
582 | static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp) | 582 | static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp) |
583 | { | 583 | { |
584 | long delta; | 584 | unsigned long j; |
585 | unsigned long js; | ||
585 | struct rcu_node *rnp; | 586 | struct rcu_node *rnp; |
586 | 587 | ||
587 | if (rcu_cpu_stall_suppress) | 588 | if (rcu_cpu_stall_suppress) |
588 | return; | 589 | return; |
589 | delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall); | 590 | j = ACCESS_ONCE(jiffies); |
591 | js = ACCESS_ONCE(rsp->jiffies_stall); | ||
590 | rnp = rdp->mynode; | 592 | rnp = rdp->mynode; |
591 | if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) { | 593 | if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && ULONG_CMP_GE(j, js)) { |
592 | 594 | ||
593 | /* We haven't checked in, so go dump stack. */ | 595 | /* We haven't checked in, so go dump stack. */ |
594 | print_cpu_stall(rsp); | 596 | print_cpu_stall(rsp); |
595 | 597 | ||
596 | } else if (rcu_gp_in_progress(rsp) && delta >= RCU_STALL_RAT_DELAY) { | 598 | } else if (rcu_gp_in_progress(rsp) && |
599 | ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY)) { | ||
597 | 600 | ||
598 | /* They had two time units to dump stack, so complain. */ | 601 | /* They had a few time units to dump stack, so complain. */ |
599 | print_other_cpu_stall(rsp); | 602 | print_other_cpu_stall(rsp); |
600 | } | 603 | } |
601 | } | 604 | } |