All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 open list <linux-kernel@vger.kernel.org>,
	regressions@lists.linux.dev,  lkft-triage@lists.linaro.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 John Donnelly <john.p.donnelly@oracle.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	 Bjorn Andersson <bjorn.andersson@linaro.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	David Hildenbrand <david@redhat.com>,
	 "Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	 Anshuman Khandual <anshuman.khandual@arm.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: gcc-12: build errors: arch/arm64/kernel/setup.c:225:56: warning: array subscript -1 is outside array bounds of 'char[]' [-Warray-bounds]
Date: Wed, 8 Jun 2022 08:54:10 +0200	[thread overview]
Message-ID: <CAK8P3a3X0UwQiVNZqvGmSKi8BX6zg=k07+9Q3rDGqHVkc8Hdsg@mail.gmail.com> (raw)
In-Reply-To: <Yp3L0JgLpk+s54Lw@FVFF77S0Q05N>

On Mon, Jun 6, 2022 at 11:41 AM Mark Rutland <mark.rutland@arm.com> wrote:
> On Fri, Jun 03, 2022 at 09:40:07AM +0200, Arnd Bergmann wrote:
>
>         #define va_init_begin() RELOC_HIDE((unsigned long)__init_begin)
>
> ... which'd be a pain, but at least it'd solve this generally.
>
> > I think the easy fix would be to reword this line to
> >
> >        kernel_code.end     = __pa_symbol(__init_begin) - 1;
> >
>
> I agree that'd work for the __pa_symbol() cases.
>
> For consistency it might be worth using RELOC_HIDE(), e.g.
>
>         kernel_code.end     = __pa_symbol(RELOC_HIDE(__init_begin)) - 1);
>asm-gener
> ... which IIUC should do the trick.
>

I see we have similar logic on each architecture, and they probably
all have the same
issue now, so maybe we can just do a helper function in include/linux/ioport.h
(which has all the struct resource logic) that can be called like

resource_set_pa(&kernel_code, _stext, __init_begin);
resource_set_pa(&kernel_data, _sdata, _end);

      Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 open list <linux-kernel@vger.kernel.org>,
	regressions@lists.linux.dev,  lkft-triage@lists.linaro.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 John Donnelly <john.p.donnelly@oracle.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	 Bjorn Andersson <bjorn.andersson@linaro.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	David Hildenbrand <david@redhat.com>,
	 "Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	 Anshuman Khandual <anshuman.khandual@arm.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: gcc-12: build errors: arch/arm64/kernel/setup.c:225:56: warning: array subscript -1 is outside array bounds of 'char[]' [-Warray-bounds]
Date: Wed, 8 Jun 2022 08:54:10 +0200	[thread overview]
Message-ID: <CAK8P3a3X0UwQiVNZqvGmSKi8BX6zg=k07+9Q3rDGqHVkc8Hdsg@mail.gmail.com> (raw)
In-Reply-To: <Yp3L0JgLpk+s54Lw@FVFF77S0Q05N>

On Mon, Jun 6, 2022 at 11:41 AM Mark Rutland <mark.rutland@arm.com> wrote:
> On Fri, Jun 03, 2022 at 09:40:07AM +0200, Arnd Bergmann wrote:
>
>         #define va_init_begin() RELOC_HIDE((unsigned long)__init_begin)
>
> ... which'd be a pain, but at least it'd solve this generally.
>
> > I think the easy fix would be to reword this line to
> >
> >        kernel_code.end     = __pa_symbol(__init_begin) - 1;
> >
>
> I agree that'd work for the __pa_symbol() cases.
>
> For consistency it might be worth using RELOC_HIDE(), e.g.
>
>         kernel_code.end     = __pa_symbol(RELOC_HIDE(__init_begin)) - 1);
>asm-gener
> ... which IIUC should do the trick.
>

I see we have similar logic on each architecture, and they probably
all have the same
issue now, so maybe we can just do a helper function in include/linux/ioport.h
(which has all the struct resource logic) that can be called like

resource_set_pa(&kernel_code, _stext, __init_begin);
resource_set_pa(&kernel_data, _sdata, _end);

      Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-08  6:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  2:03 gcc-12: build errors: arch/arm64/kernel/setup.c:225:56: warning: array subscript -1 is outside array bounds of 'char[]' [-Warray-bounds] Naresh Kamboju
2022-06-03  2:03 ` Naresh Kamboju
2022-06-03  7:40 ` Arnd Bergmann
2022-06-03  7:40   ` Arnd Bergmann
2022-06-06  9:01   ` Maxime Ripard
2022-06-06  9:01     ` Maxime Ripard
2022-06-06  9:41   ` Mark Rutland
2022-06-06  9:41     ` Mark Rutland
2022-06-08  6:54     ` Arnd Bergmann [this message]
2022-06-08  6:54       ` Arnd Bergmann

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='CAK8P3a3X0UwQiVNZqvGmSKi8BX6zg=k07+9Q3rDGqHVkc8Hdsg@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=david@redhat.com \
    --cc=gpiccoli@igalia.com \
    --cc=john.p.donnelly@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mark.rutland@arm.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=regressions@lists.linux.dev \
    --cc=thunder.leizhen@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.