aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <[email protected]>2018-03-09 23:51:20 +0000
committerLinus Torvalds <[email protected]>2018-03-10 00:40:02 +0000
commitac68b1b3b9c73e652dc7ce0585672e23c5a2dca4 (patch)
treebff6f75c172acda7f0240223c222fb3d1af58aaa /lib/string_helpers.c
parentselftests/vm/run_vmtests: adjust hugetlb size according to nr_cpus (diff)
downloadkernel-ac68b1b3b9c73e652dc7ce0585672e23c5a2dca4.tar.gz
kernel-ac68b1b3b9c73e652dc7ce0585672e23c5a2dca4.zip
lib/test_kmod.c: fix limit check on number of test devices created
As reported by Dan the parentheses is in the wrong place, and since unlikely() call returns either 0 or 1 it's never less than zero. The second issue is that signed integer overflows like "INT_MAX + 1" are undefined behavior. Since num_test_devs represents the number of devices, we want to stop prior to hitting the max, and not rely on the wrap arround at all. So just cap at num_test_devs + 1, prior to assigning a new device. Link: http://lkml.kernel.org/r/[email protected] Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Acked-by: Kees Cook <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions