From: Andrew Morton <akpm@linux-foundation.org>
To: Kairui Song <ryncsn@gmail.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
Chris Li <chrisl@kernel.org>, linux-mm <linux-mm@kvack.org>,
open list <linux-kernel@vger.kernel.org>,
lkft-triage@lists.linaro.org,
Linux Regressions <regressions@lists.linux.dev>,
Barry Song <21cnbao@gmail.com>,
"Huang, Ying" <ying.huang@intel.com>,
Hugh Dickins <hughd@google.com>,
Kalesh Singh <kaleshsingh@google.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Anders Roxell <anders.roxell@linaro.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]
Date: Mon, 19 Aug 2024 22:05:48 -0700 [thread overview]
Message-ID: <20240819220548.d8f1ea5cf504cfd8feb5780e@linux-foundation.org> (raw)
In-Reply-To: <CAMgjq7Bz0DY+rY0XgCoH7-Q=uHLdo3omi8kUr4ePDweNyofsbQ@mail.gmail.com>
On Mon, 19 Aug 2024 19:44:25 +0800 Kairui Song <ryncsn@gmail.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.
next prev parent reply other threads:[~2024-08-20 5:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 8:28 Naresh Kamboju
2024-08-19 10:15 ` Naresh Kamboju
2024-08-19 11:44 ` Kairui Song
2024-08-19 19:57 ` Naresh Kamboju
2024-08-20 5:05 ` Andrew Morton [this message]
2024-08-20 8:51 ` Chris Li
2024-08-27 8:47 ` Kairui Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240819220548.d8f1ea5cf504cfd8feb5780e@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=21cnbao@gmail.com \
--cc=anders.roxell@linaro.org \
--cc=chrisl@kernel.org \
--cc=hughd@google.com \
--cc=kaleshsingh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkft-triage@lists.linaro.org \
--cc=naresh.kamboju@linaro.org \
--cc=regressions@lists.linux.dev \
--cc=ryan.roberts@arm.com \
--cc=ryncsn@gmail.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox