Re: [RESEND#2 PATCH] mm/compaction: fix an undefined behaviour

2019-03-20 Thread Qian Cai
On 3/20/19 5:58 PM, Andrew Morton wrote: >> --- >> mm/compaction.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/mm/compaction.c b/mm/compaction.c >> index e1a08fc92353..0d1156578114 100644 >> --- a/mm/compaction.c >> +++ b/mm/compaction.c >> @@ -1157,7 +1157,9

Re: [RESEND#2 PATCH] mm/compaction: fix an undefined behaviour

2019-03-20 Thread Andrew Morton
On Wed, 20 Mar 2019 16:33:38 -0400 Qian Cai wrote: > In a low-memory situation, cc->fast_search_fail can keep increasing as > it is unable to find an available page to isolate in > fast_isolate_freepages(). As the result, it could trigger an error > below, so just compare with the maximum bits

[RESEND#2 PATCH] mm/compaction: fix an undefined behaviour

2019-03-20 Thread Qian Cai
In a low-memory situation, cc->fast_search_fail can keep increasing as it is unable to find an available page to isolate in fast_isolate_freepages(). As the result, it could trigger an error below, so just compare with the maximum bits can be shifted first. UBSAN: Undefined behaviour in