lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqBgWoXQmzVczRDo@debian.me>
Date:   Wed, 8 Jun 2022 15:39:54 +0700
From:   Bagas Sanjaya <bagasdotme@...il.com>
To:     Linux ARM <linux-arm-kernel@...ts.infradead.org>
Cc:     BenoƮt Cousson <bcousson@...libre.com>,
        Tony Lindgren <tony@...mide.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-omap@...r.kernel.org, devicetree@...r.kernel.org,
        Russell King <linux@...linux.org.uk>,
        Linus Walleij <linus.walleij@...aro.org>,
        "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
        linux-kernel@...r.kernel.org
Subject: virt_to_phys outside array bounds warning (GCC 12.1.0)

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@...il.com>

-- 
An old man doll... just what I always wanted! - Clara

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ