Re: [masahiroy-kbuild:kbuild 5/7] kernel/kallsyms.c:181:56: warning: array subscript is outside array bounds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 23 Apr 2024 at 05:50, kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kbuild
> head:   8246a1e9b922c0e797ec28d8a602de1384ff8140
> commit: 0bdad28369fc5e93de39b5046228ed78e982fc71 [5/7] kallsyms: Avoid weak references for kallsyms symbols
> config: i386-randconfig-001-20240423 (https://download.01.org/0day-ci/archive/20240423/202404231102.r0G0StUJ-lkp@xxxxxxxxx/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240423/202404231102.r0G0StUJ-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202404231102.r0G0StUJ-lkp@xxxxxxxxx/
>
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
>
> All warnings (new ones prefixed by >>):
>
>    kernel/kallsyms.c: In function 'get_symbol_pos':
> >> kernel/kallsyms.c:181:56: warning: array subscript is outside array bounds [-Warray-bounds]
>       return kallsyms_relative_base + (u32)kallsyms_offsets[idx];
>

OK, so weak definitions result in compiler warnings. I don't know
whether C requires weak definitions of array types are always the same
size.

We could work around this by
a) emitting the weak definitions into a separate object file, although
this may still violate C, and does not hide the issue from LTO
b) go back to using PROVIDE() in the linker scripts

@Masahiro: any preference?




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux