lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 20 Mar 2019 18:12:40 -0400
From:   Qian Cai <cai@....pw>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     mgorman@...hsingularity.net, vbabka@...e.cz, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RESEND#2 PATCH] mm/compaction: fix an undefined behaviour



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 @@ static bool suitable_migration_target(struct compact_control *cc,
>>  static inline unsigned int
>>  freelist_scan_limit(struct compact_control *cc)
>>  {
>> -	return (COMPACT_CLUSTER_MAX >> cc->fast_search_fail) + 1;
>> +	return (COMPACT_CLUSTER_MAX >>
>> +		min((unsigned short)(BITS_PER_LONG - 1), cc->fast_search_fail))
>> +		+ 1;
>>  }
> 
> That's rather an eyesore.  How about
> 
> static inline unsigned int
> freelist_scan_limit(struct compact_control *cc)
> {
> 	unsigned short shift = BITS_PER_LONG - 1;
> 
> 	return (COMPACT_CLUSTER_MAX >> min(shift, cc->fast_search_fail)) + 1;
> }

Agree. It looks better.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ