aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fault-inject.c
diff options
context:
space:
mode:
authorMichael Ellerman <[email protected]>2017-07-14 21:49:41 +0000
committerLinus Torvalds <[email protected]>2017-07-14 22:05:13 +0000
commitffba19ccae8d98beb0a17345a0b1ee9e415b23b8 (patch)
tree296a447d459113fb7fb12c25c238409c542b9485 /lib/fault-inject.c
parentmm: fix overflow check in expand_upwards() (diff)
downloadkernel-ffba19ccae8d98beb0a17345a0b1ee9e415b23b8.tar.gz
kernel-ffba19ccae8d98beb0a17345a0b1ee9e415b23b8.zip
lib/atomic64_test.c: add a test that atomic64_inc_not_zero() returns an int
atomic64_inc_not_zero() returns a "truth value" which in C is traditionally an int. That means callers are likely to expect the result will fit in an int. If an implementation returns a "true" value which does not fit in an int, then there's a possibility that callers will truncate it when they store it in an int. In fact this happened in practice, see commit 966d2b04e070 ("percpu-refcount: fix reference leak during percpu-atomic transition"). So add a test that the result fits in an int, even when the input doesn't. This catches the case where an implementation just passes the non-zero input value out as the result. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Michael Ellerman <[email protected]> Cc: Douglas Miller <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/fault-inject.c')
0 files changed, 0 insertions, 0 deletions