]> git.karo-electronics.de Git - karo-tx-linux.git/commit
rcu: Eliminate signed overflow in synchronize_rcu_expedited()
authorPaul E. McKenney <paul.mckenney@linaro.org>
Mon, 23 Jul 2012 23:03:51 +0000 (16:03 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 5 Sep 2012 19:01:11 +0000 (12:01 -0700)
commitcca673f5e91aa6f913642b1359ef17b7ce283d3f
tree6663518c2a76bb06aa27cb4a892bd1115aa39cf4
parent18bf6191a9cd3f501bde02e1bbce6654395ba584
rcu: Eliminate signed overflow in synchronize_rcu_expedited()

In the C language, signed overflow is undefined.  It is true that
twos-complement arithmetic normally comes to the rescue, but if the
compiler can subvert this any time it has any information about the values
being compared.  For example, given "if (a - b > 0)", if the compiler
has enough information to realize that (for example) the value of "a"
is positive and that of "b" is negative, the compiler is within its
rights to optimize to a simple "if (1)", which might not be what you want.

This commit therefore converts synchronize_rcu_expedited()'s work-done
detection counter from signed to unsigned.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/rcutree_plugin.h