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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 19 May 2022 22:28:24 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     kernel test robot <lkp@...el.com>
Cc:     Mel Gorman <mgorman@...e.de>, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: mm/page_alloc.c:984:9: warning: iteration 119304648 invokes
 undefined behavior

On Fri, May 20, 2022 at 05:14:52AM +0800, kernel test robot wrote:
> All warnings (new ones prefixed by >>):
> 
>    mm/page_alloc.c: In function 'rmqueue.isra':
> >> mm/page_alloc.c:984:9: warning: iteration 119304648 invokes undefined behavior [-Waggressive-loop-optimizations]
>      984 |         list_add(&page->lru, &area->free_list[migratetype]);
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    mm/page_alloc.c:2305:21: note: within this loop
>     2305 |         while (high > low) {
>          |                ~~~~~^~~~~

That's OK.  'high' and 'low' are page orders.  They both lie in the
range [0,63], so this will not iterate 119304648 times (what a funny
number; I wonder why GCC chose it).

Can we make GCC happier by telling it that low and high are unsigned?
It should have figured out that 'high' is <= 63 already, as that's a
consequence of:

        unsigned long size = 1 << high;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ