From: Kairui Song <ryncsn@gmail.com>
To: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: 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>,
Andrew Morton <akpm@linux-foundation.org>,
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 19:44:25 +0800 [thread overview]
Message-ID: <CAMgjq7Bz0DY+rY0XgCoH7-Q=uHLdo3omi8kUr4ePDweNyofsbQ@mail.gmail.com> (raw)
In-Reply-To: <CA+G9fYtd1Hw9YLpceUAwwC+UytVQVXOET4gmGT9jiCgHa+WexQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 849 bytes --]
On Mon, Aug 19, 2024 at 6:16 PM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
>
> On Mon, 19 Aug 2024 at 13:58, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> >
> > The x86 builds failed with gcc-8 due to following build warnings / errors on
> > Linux next-20240802 to next-20240819.
> >
> > x86_64 defconfig gcc-8 build failed
> > x86_64 defconfig gcc-13 build pass
> >
> > First seen on the next-20240802 tag.
> >
> > GOOD: next-20240730
> > BAD: next-20240802
>
> Anders bisected this and found the first bad commit id as,
> aded4352f648 ("mm: swap: separate SSD allocation from
> scan_swap_map_slots()") first faulty one
>
> - Naresh
>
Hi Naresh,
Thanks for the report, the problem will occur when CONFIG_THP_SWAP is
disabled. Can you try the following patch? I can confirm it's fixed
with my test.
[-- Attachment #2: 0001-mm-swap-fix-array-bounds-error-with-CONFIG_THP_SWAP-.patch --]
[-- Type: application/octet-stream, Size: 880 bytes --]
From 89f0aafa03ad5878e8902e07e12ec0c020dba2df Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@tencent.com>
Date: Mon, 19 Aug 2024 19:31:55 +0800
Subject: [PATCH] mm: swap: fix array-bounds error with CONFIG_THP_SWAP=n
Signed-off-by: Kairui Song <kasong@tencent.com>
---
mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d9cf31b04db3..16ec6b7df198 100644
--- 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.
--
2.45.2
next prev parent reply other threads:[~2024-08-19 11:44 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 [this message]
2024-08-19 19:57 ` Naresh Kamboju
2024-08-20 5:05 ` Andrew Morton
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='CAMgjq7Bz0DY+rY0XgCoH7-Q=uHLdo3omi8kUr4ePDweNyofsbQ@mail.gmail.com' \
--to=ryncsn@gmail.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--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=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