]> 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>
Tue, 31 Jul 2012 18:32:55 +0000 (11:32 -0700)
commit3009bd3c88152f5860483551cea4446aa0ae33f6
tree30eb1eec4695216c36166aac4050027602b79709
parenta645f71642db223db022f4574b14b3822ee6ae97
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>
kernel/rcutree_plugin.h