Luis R. Rodriguez
e2d9442dfe
lib/test_kmod.c: fix limit check on number of test devices created
...
[ Upstream commit ac68b1b3b9c73e652dc7ce0585672e23c5a2dca4 ]
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/20180224030046.24238-1-mcgrof@kernel.org
Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30 07:52:14 +02:00
..
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-03 17:54:25 -07:00
2017-11-02 11:10:55 +01:00
2018-03-03 10:24:29 +01:00
2017-11-02 11:10:55 +01:00
2017-05-08 17:15:12 -07:00
2017-08-15 09:02:08 -07:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:52:52 +01:00
2017-10-28 10:31:07 -07:00
2017-07-14 15:05:13 -07:00
locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
2016-06-16 10:48:32 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-19 08:56:20 +02:00
2017-07-10 16:32:35 -07:00
2015-11-23 09:44:58 +01:00
2018-03-15 10:54:32 +01:00
2017-11-02 11:10:55 +01:00
2016-07-03 00:57:23 -04:00
2017-11-02 11:10:55 +01:00
2016-03-13 23:55:13 -04:00
2017-11-02 11:10:55 +01:00
2017-09-08 18:26:49 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-06-09 11:52:07 +02:00
2017-02-24 17:46:57 -08:00
2017-11-02 11:10:55 +01:00
2017-02-24 17:46:57 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-14 16:51:01 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-02-24 17:46:57 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-12 17:16:40 +01:00
2017-11-02 11:10:55 +01:00
2017-05-09 15:40:28 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:08 +01:00
2017-11-02 11:10:55 +01:00
2016-06-08 11:04:19 +02:00
2018-05-09 09:51:54 +02:00
2017-07-10 16:32:35 -07:00
2017-08-10 15:54:06 -07:00
2017-02-24 17:46:57 -08:00
2017-11-02 11:10:55 +01:00
2016-05-20 17:58:30 -07:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:08 +01:00
2017-02-24 17:46:57 -08:00
2017-02-24 17:46:57 -08:00
2017-09-08 18:26:49 -07:00
2017-11-02 11:10:55 +01:00
2017-10-03 17:54:25 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-08 18:26:49 -07:00
2016-01-20 17:09:18 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:38 +02:00
2017-09-20 23:27:48 -04:00
2017-11-02 11:10:55 +01:00
2017-03-02 08:42:38 +01:00
2017-11-02 11:10:55 +01:00
2017-09-14 17:30:49 -07:00
2018-02-22 15:42:24 +01:00
2018-02-16 20:23:04 +01:00
2017-05-16 08:44:22 -03:00
2016-12-14 16:04:08 -08:00
2016-02-07 22:18:47 -08:00
2017-09-18 16:48:33 +02:00
2018-05-01 12:58:19 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-06-08 17:36:03 +08:00
2017-02-24 17:46:56 -08:00
2017-11-02 11:10:55 +01:00
2015-11-06 17:50:42 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2015-11-25 09:22:02 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2015-12-03 11:49:23 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-25 11:08:01 +01:00
2017-11-02 11:10:55 +01:00
2017-02-03 16:35:42 -05:00
2016-12-06 10:17:03 +02:00
2017-11-02 11:10:55 +01:00
2017-03-02 08:42:34 +01:00
2017-03-22 19:18:43 -07:00
2017-03-02 08:42:27 +01:00
2017-01-23 09:17:12 +01:00
2018-05-30 07:51:49 +02:00
2017-11-02 11:10:55 +01:00
2017-10-03 17:54:26 -07:00
2017-11-02 11:10:55 +01:00
2017-09-08 18:26:48 -07:00
2017-09-08 18:26:48 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-03-31 18:10:40 +02:00
2017-04-14 14:06:52 -06:00
2017-06-15 14:30:14 +02:00
2017-11-02 11:10:55 +01:00
2016-04-15 16:53:14 -04:00
2017-11-02 11:10:55 +01:00
2017-02-22 16:41:30 -08:00
2017-01-09 13:58:57 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-11-11 08:12:37 -08:00
2017-09-13 18:53:16 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-22 15:42:15 +01:00
2017-11-02 11:10:55 +01:00
2018-05-22 18:53:58 +02:00
2018-04-26 11:02:16 +02:00
2017-09-08 18:26:49 -07:00
2018-02-03 17:39:24 +01:00
2016-09-01 17:52:01 -07:00
2016-01-20 17:09:18 -08:00
2017-03-31 17:13:30 -07:00
2018-05-30 07:52:14 +02:00
2017-05-08 17:15:10 -07:00
2017-02-26 11:03:38 -05:00
2016-03-15 16:55:16 -07:00
2017-07-25 12:35:23 -07:00
2017-01-09 13:58:57 -05:00
2017-05-08 17:15:10 -07:00
2016-02-09 10:27:29 +01:00
2017-07-12 16:26:00 -07:00
2017-05-01 09:36:30 +02:00
2017-07-21 09:38:30 +02:00
2016-02-03 08:28:43 -08:00
2017-01-20 08:03:42 +01:00
2017-10-22 03:14:07 +01:00
2017-10-22 03:14:07 +01:00
2018-02-16 20:23:09 +01:00
2018-02-16 20:23:09 +01:00
2017-11-02 11:10:55 +01:00
2018-03-19 08:42:56 +01:00
2017-06-05 16:59:05 +02:00
2017-07-07 10:37:54 -07:00
2017-11-02 11:10:55 +01:00
2017-08-15 09:02:07 -07:00