aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-11-21 17:19:26 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-01-10 22:07:58 -0500
commit6b80da42c02bc731ab38b6a37da5366abe26717f (patch)
tree9f0e6e658614c65a2a2df4bc2f3ae7508a6e6fce /kernel/rcu
parent3b009c0ebe02a06d2d5bd667da0eb9cefa79321d (diff)
rcutorture: Use unsigned for Reader Batch computations
The counter returned by the various ->completed functions is subject to overflow, which means that subtracting two such counters might result in overflow, which invokes undefined behavior in the C standard. This commit therefore changes these functions and variables to unsigned to avoid this undefined behavior. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/rcutorture.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 4d559baf06e0..f43e3517f5f5 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -244,7 +244,7 @@ struct rcu_torture_ops {
244 int (*readlock)(void); 244 int (*readlock)(void);
245 void (*read_delay)(struct torture_random_state *rrsp); 245 void (*read_delay)(struct torture_random_state *rrsp);
246 void (*readunlock)(int idx); 246 void (*readunlock)(int idx);
247 int (*completed)(void); 247 unsigned long (*completed)(void);
248 void (*deferred_free)(struct rcu_torture *p); 248 void (*deferred_free)(struct rcu_torture *p);
249 void (*sync)(void); 249 void (*sync)(void);
250 void (*exp_sync)(void); 250 void (*exp_sync)(void);
@@ -296,7 +296,7 @@ static void rcu_torture_read_unlock(int idx) __releases(RCU)
296 rcu_read_unlock(); 296 rcu_read_unlock();
297} 297}
298 298
299static int rcu_torture_completed(void) 299static unsigned long rcu_torture_completed(void)
300{ 300{
301 return rcu_batches_completed(); 301 return rcu_batches_completed();
302} 302}
@@ -356,7 +356,7 @@ rcu_torture_cb(struct rcu_head *p)
356 cur_ops->deferred_free(rp); 356 cur_ops->deferred_free(rp);
357} 357}
358 358
359static int rcu_no_completed(void) 359static unsigned long rcu_no_completed(void)
360{ 360{
361 return 0; 361 return 0;
362} 362}
@@ -407,7 +407,7 @@ static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)
407 rcu_read_unlock_bh(); 407 rcu_read_unlock_bh();
408} 408}
409 409
410static int rcu_bh_torture_completed(void) 410static unsigned long rcu_bh_torture_completed(void)
411{ 411{
412 return rcu_batches_completed_bh(); 412 return rcu_batches_completed_bh();
413} 413}
@@ -510,7 +510,7 @@ static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl)
510 srcu_read_unlock(&srcu_ctl, idx); 510 srcu_read_unlock(&srcu_ctl, idx);
511} 511}
512 512
513static int srcu_torture_completed(void) 513static unsigned long srcu_torture_completed(void)
514{ 514{
515 return srcu_batches_completed(&srcu_ctl); 515 return srcu_batches_completed(&srcu_ctl);
516} 516}
@@ -1015,8 +1015,8 @@ static void rcutorture_trace_dump(void)
1015static void rcu_torture_timer(unsigned long unused) 1015static void rcu_torture_timer(unsigned long unused)
1016{ 1016{
1017 int idx; 1017 int idx;
1018 int completed; 1018 unsigned long completed;
1019 int completed_end; 1019 unsigned long completed_end;
1020 static DEFINE_TORTURE_RANDOM(rand); 1020 static DEFINE_TORTURE_RANDOM(rand);
1021 static DEFINE_SPINLOCK(rand_lock); 1021 static DEFINE_SPINLOCK(rand_lock);
1022 struct rcu_torture *p; 1022 struct rcu_torture *p;
@@ -1073,8 +1073,8 @@ static void rcu_torture_timer(unsigned long unused)
1073static int 1073static int
1074rcu_torture_reader(void *arg) 1074rcu_torture_reader(void *arg)
1075{ 1075{
1076 int completed; 1076 unsigned long completed;
1077 int completed_end; 1077 unsigned long completed_end;
1078 int idx; 1078 int idx;
1079 DEFINE_TORTURE_RANDOM(rand); 1079 DEFINE_TORTURE_RANDOM(rand);
1080 struct rcu_torture *p; 1080 struct rcu_torture *p;