* virt_to_phys outside array bounds warning (GCC 12.1.0)
@ 2022-06-08 8:39 Bagas Sanjaya
2022-06-08 9:28 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Bagas Sanjaya @ 2022-06-08 8:39 UTC (permalink / raw)
To: Linux ARM
Cc: Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, linux-omap, devicetree, Russell King,
Linus Walleij, Russell King (Oracle), linux-kernel
Hi everyone,
When cross-compiling arm 5.19-rc1 kernel using GCC 12.1.0 (armv7 with neon
fpu, multi_v7_defconfig), I got outside array bounds warning pointing to
virt_to_phys() macro:
DTC arch/arm/boot/dts/am335x-evm.dtb
In file included from ./arch/arm/include/asm/page.h:163,
from ./arch/arm/include/asm/thread_info.h:14,
from ./include/linux/thread_info.h:60,
from ./include/asm-generic/preempt.h:5,
from ./arch/arm/include/generated/asm/preempt.h:1,
from ./include/linux/preempt.h:78,
from ./include/linux/spinlock.h:55,
from ./include/linux/wait.h:9,
from ./include/linux/wait_bit.h:8,
from ./include/linux/fs.h:6,
from ./include/linux/proc_fs.h:10,
from ./include/linux/efi.h:19,
from arch/arm/kernel/setup.c:7:
In function 'request_standard_resources',
inlined from 'setup_arch' at arch/arm/kernel/setup.c:1158:2:
./arch/arm/include/asm/memory.h:311:22: warning: array subscript -1 is outside array bounds of 'char[2147483647]' [-Warray-bounds]
311 | #define virt_to_phys virt_to_phys
arch/arm/kernel/setup.c:855:31: note: in expansion of macro 'virt_to_phys'
855 | kernel_code.end = virt_to_phys(__init_begin - 1);
| ^~~~~~~~~~~~
In file included from ./include/linux/pid_namespace.h:7,
from ./include/linux/ptrace.h:10,
from ./include/linux/elfcore.h:11,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from arch/arm/kernel/setup.c:20:
./include/linux/mm.h: In function 'setup_arch':
./include/linux/mm.h:2500:21: note: at offset -1 into object '__init_begin' of size [0, 2147483647]
2500 | extern char __init_begin[], __init_end[];
| ^~~~~~~~~~~~
In function 'request_standard_resources',
inlined from 'setup_arch' at arch/arm/kernel/setup.c:1158:2:
./arch/arm/include/asm/memory.h:311:22: warning: array subscript -1 is outside array bounds of 'char[2147483647]' [-Warray-bounds]
311 | #define virt_to_phys virt_to_phys
arch/arm/kernel/setup.c:857:31: note: in expansion of macro 'virt_to_phys'
857 | kernel_data.end = virt_to_phys(_end - 1);
| ^~~~~~~~~~~~
In file included from ./arch/arm/include/asm/sections.h:5,
from ./include/linux/interrupt.h:21,
from ./include/linux/rtc.h:17,
from ./include/linux/efi.h:20:
./include/asm-generic/sections.h: In function 'setup_arch':
./include/asm-generic/sections.h:41:13: note: at offset -1 into object '_end' of size [0, 2147483647]
41 | extern char _end[];
| ^~~~
Thanks.
Reported-by: Bagas Sanjaya <bagasdotme@gmail.com>
--
An old man doll... just what I always wanted! - Clara
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: virt_to_phys outside array bounds warning (GCC 12.1.0)
2022-06-08 8:39 virt_to_phys outside array bounds warning (GCC 12.1.0) Bagas Sanjaya
@ 2022-06-08 9:28 ` Krzysztof Kozlowski
2022-06-08 9:51 ` Bagas Sanjaya
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-08 9:28 UTC (permalink / raw)
To: Bagas Sanjaya, Linux ARM
Cc: Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, linux-omap, devicetree, Russell King,
Linus Walleij, Russell King (Oracle), linux-kernel
On 08/06/2022 10:39, Bagas Sanjaya wrote:
> Hi everyone,
>
> When cross-compiling arm 5.19-rc1 kernel using GCC 12.1.0 (armv7 with neon
> fpu, multi_v7_defconfig), I got outside array bounds warning pointing to
> virt_to_phys() macro:
>
Thanks for the report!
I think this was already reported:
https://lore.kernel.org/all/CAK8P3a3X0UwQiVNZqvGmSKi8BX6zg=k07+9Q3rDGqHVkc8Hdsg@mail.gmail.com/
Anyway, for the future:
I don't think the CC list matches the problem. Please bisect this issue
(since it is reproducible build time, it should be straightforward) to
find offending commit and then Cc responsible people and maintainers
(scripts/get_maintainer.pl). Ccing half-random people might not get
necessary attention.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: virt_to_phys outside array bounds warning (GCC 12.1.0)
2022-06-08 9:28 ` Krzysztof Kozlowski
@ 2022-06-08 9:51 ` Bagas Sanjaya
0 siblings, 0 replies; 3+ messages in thread
From: Bagas Sanjaya @ 2022-06-08 9:51 UTC (permalink / raw)
To: Krzysztof Kozlowski, Linux ARM
Cc: Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, linux-omap, devicetree, Russell King,
Linus Walleij, Russell King (Oracle), linux-kernel, Kees Cook,
Naresh Kamboju, Andrew Morton
On 6/8/22 16:28, Krzysztof Kozlowski wrote:
> On 08/06/2022 10:39, Bagas Sanjaya wrote:
>> Hi everyone,
>>
>> When cross-compiling arm 5.19-rc1 kernel using GCC 12.1.0 (armv7 with neon
>> fpu, multi_v7_defconfig), I got outside array bounds warning pointing to
>> virt_to_phys() macro:
>>
>
> Thanks for the report!
>
> I think this was already reported:
> https://lore.kernel.org/all/CAK8P3a3X0UwQiVNZqvGmSKi8BX6zg=k07+9Q3rDGqHVkc8Hdsg@mail.gmail.com/
>
The report above is for arm64, but similar to this report (arm report).
> Anyway, for the future:
> I don't think the CC list matches the problem. Please bisect this issue
> (since it is reproducible build time, it should be straightforward) to
> find offending commit and then Cc responsible people and maintainers
> (scripts/get_maintainer.pl). Ccing half-random people might not get
> necessary attention.
>
I think the most likely culprit is commit 37efe6427dd50e ("[ARM] use asm/sections.h")
and 14c4a533e0996f ("ARM: 8583/1: mm: fix location of _etext").
Thanks.
--
An old man doll... just what I always wanted! - Clara
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-08 10:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-08 8:39 virt_to_phys outside array bounds warning (GCC 12.1.0) Bagas Sanjaya
2022-06-08 9:28 ` Krzysztof Kozlowski
2022-06-08 9:51 ` Bagas Sanjaya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).