Messages in this thread | | | From | Arnd Bergmann <> | Date | Wed, 8 Jun 2022 08:54:10 +0200 | 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] |
| |
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
| |