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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240819220548.d8f1ea5cf504cfd8feb5780e@linux-foundation.org>
Date: Mon, 19 Aug 2024 22:05:48 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Kairui Song <ryncsn@...il.com>
Cc: Naresh Kamboju <naresh.kamboju@...aro.org>, Chris Li
 <chrisl@...nel.org>, linux-mm <linux-mm@...ck.org>, open list
 <linux-kernel@...r.kernel.org>, lkft-triage@...ts.linaro.org, Linux
 Regressions <regressions@...ts.linux.dev>, Barry Song <21cnbao@...il.com>,
 "Huang, Ying" <ying.huang@...el.com>, Hugh Dickins <hughd@...gle.com>,
 Kalesh Singh <kaleshsingh@...gle.com>, Ryan Roberts <ryan.roberts@....com>,
 Anders Roxell <anders.roxell@...aro.org>
Subject: Re: gcc-8: mm/swapfile.c:863:40: error: array subscript 1 is above
 array bounds of 'struct list_head[1]' [-Werror=array-bounds]

On Mon, 19 Aug 2024 19:44:25 +0800 Kairui Song <ryncsn@...il.com> wrote:

> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -836,7 +836,7 @@ static unsigned long cluster_alloc_swap_entry(struct swap_info_struct *si, int o
>  		goto done;
>  
>  	/* Order 0 stealing from higher order */
> -	for (int o = 1; o < PMD_ORDER; o++) {
> +	for (int o = 1; o < SWAP_NR_ORDERS; o++) {
>  		/*
>  		 * Clusters here have at least one usable slots and can't fail order 0
>  		 * allocation, but reclaim may drop si->lock and race with another user.

OK, I got that landed in the right place, but...

The definition of `o' within the for statement isn't typical kernel
style - I'm surprised we didn't get a warning for this - maybe things
have changed when I wasn't looking.

Also, this code makes no attempt to honor our "The preferred limit on
the length of a single line is 80 columns" objective.  There's just no
reason for comment blocks to violate this.

So Chris, please attend to such things when preparing v6, which I
assume is in the works.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ