]> 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>
Thu, 20 Sep 2012 21:55:48 +0000 (14:55 -0700)
commit4d1e36ec66332167f65448f75b4ff4817bf8d62a
treef647af2c4cca750e91e2de10276157fa74f3d461
parentc9961e7659c2ce8dd6d37d030bac580506248e3a
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