From: kernel test robot <lkp@intel.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kbuild@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>
Subject: [masahiroy-kbuild:kbuild 5/7] kernel/kallsyms.c:181:56: warning: array subscript [0, 0] is outside array bounds of 'const int[1]'
Date: Tue, 23 Apr 2024 10:53:42 +0800 [thread overview]
Message-ID: <202404231047.eZ27wCnE-lkp@intel.com> (raw)
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-buildonly-randconfig-003-20240423 (https://download.01.org/0day-ci/archive/20240423/202404231047.eZ27wCnE-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.5.0-4ubuntu2) 9.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240423/202404231047.eZ27wCnE-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404231047.eZ27wCnE-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/kallsyms.c: In function 'get_symbol_pos':
>> kernel/kallsyms.c:181:56: warning: array subscript [0, 0] is outside array bounds of 'const int[1]' [-Warray-bounds]
181 | return kallsyms_relative_base + (u32)kallsyms_offsets[idx];
| ~~~~~~~~~~~~~~~~^~~~~
kernel/kallsyms.c:48:18: note: while referencing 'kallsyms_offsets'
48 | const int __weak kallsyms_offsets[1];
| ^~~~~~~~~~~~~~~~
vim +181 kernel/kallsyms.c
^1da177e4c3f415 Linus Torvalds 2005-04-16 173
30f3bb09778de64 Zhen Lei 2022-11-15 174 unsigned long kallsyms_sym_address(int idx)
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 175 {
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 176 if (!IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE))
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 177 return kallsyms_addresses[idx];
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 178
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 179 /* values are unsigned offsets if --absolute-percpu is not in effect */
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 180 if (!IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PERCPU))
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 @181 return kallsyms_relative_base + (u32)kallsyms_offsets[idx];
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 182
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 183 /* ...otherwise, positive offsets are absolute values */
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 184 if (kallsyms_offsets[idx] >= 0)
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 185 return kallsyms_offsets[idx];
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 186
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 187 /* ...and negative offsets are relative to kallsyms_relative_base - 1 */
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 188 return kallsyms_relative_base - 1 - kallsyms_offsets[idx];
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 189 }
2213e9a66bb87d8 Ard Biesheuvel 2016-03-15 190
:::::: The code at line 181 was first introduced by commit
:::::: 2213e9a66bb87d8344a1256b4ef568220d9587fb kallsyms: add support for relative offsets in kallsyms address table
:::::: TO: Ard Biesheuvel <ard.biesheuvel@linaro.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-04-23 2:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202404231047.eZ27wCnE-lkp@intel.com \
--to=lkp@intel.com \
--cc=ardb@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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 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 read-only IMAP folder(s) and NNTP newsgroup(s).