Yanfei Xu 54dd200c5a mm/kmemleak: fix possible wrong memory scanning period
This commit contains 3 modifications:

1. Convert the type of jiffies_scan_wait to "unsigned long".

2. Use READ/WRITE_ONCE() for accessing "jiffies_scan_wait".

3. Fix the possible wrong memory scanning period.  If you set a large
   memory scanning period like blow, then the "secs" variable will be
   non-zero, however the value of "jiffies_scan_wait" will be zero.

    echo "scan=0x10000000" > /sys/kernel/debug/kmemleak

It is because the type of the msecs_to_jiffies()'s parameter is "unsigned
int", and the "secs * 1000" is larger than its max value.  This in turn
leads a unexpected jiffies_scan_wait, maybe zero.  We corret it by
replacing kstrtoul() with kstrtouint(), and check the msecs to prevent it
larger than UINT_MAX.

Link: https://lkml.kernel.org/r/20210613174022.23044-1-yanfei.xu@windriver.com
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-29 10:53:47 -07:00
..
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-05-07 00:26:35 -07:00
2021-02-24 13:38:27 -08:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-14 19:41:32 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:27 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:34 -07:00
2021-05-07 00:26:35 -07:00
2021-03-02 17:25:46 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-04-16 16:10:37 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-05 11:27:25 -07:00
2021-05-05 11:27:27 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00
2021-05-07 00:26:35 -07:00