[oracle-dtrace:v2/5.17-rc2 6/10] kernel/kallsyms.c:775:17: error: expected expression before 'unsigned'
From: kernel test robot
Date: Fri Feb 04 2022 - 18:15:59 EST
tree: https://github.com/oracle/dtrace-linux-kernel v2/5.17-rc2
head: 47946e7b2e2319f39cbb7f8aaa294298c2dec5b4
commit: ea16e4ce65d8342913051086a89eac87dc54aced [6/10] kallsyms: add /proc/kallmodsyms
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20220205/202202050735.guXoa1xq-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/oracle/dtrace-linux-kernel/commit/ea16e4ce65d8342913051086a89eac87dc54aced
git remote add oracle-dtrace https://github.com/oracle/dtrace-linux-kernel
git fetch --no-tags oracle-dtrace v2/5.17-rc2
git checkout ea16e4ce65d8342913051086a89eac87dc54aced
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All error/warnings (new ones prefixed by >>):
kernel/kallsyms.c:666:12: warning: no previous prototype for 'arch_get_kallsym' [-Wmissing-prototypes]
666 | int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value,
| ^~~~~~~~~~~~~~~~
kernel/kallsyms.c: In function 'get_ksymbol_core':
>> kernel/kallsyms.c:775:17: error: expected expression before 'unsigned'
775 | unsigned long mod_idx = (unsigned long) -1;
| ^~~~~~~~
In file included from arch/powerpc/include/asm/cmpxchg.h:6,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/mm_types_task.h:13,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/kallsyms.h:10,
from kernel/kallsyms.c:15:
>> kernel/kallsyms.c:806:42: warning: comparison between pointer and integer
806 | if (likely(iter->value != &_etext))
| ^~
include/linux/compiler.h:77:45: note: in definition of macro 'likely'
77 | # define likely(x) __builtin_expect(!!(x), 1)
| ^
kernel/kallsyms.c:804:31: warning: unused variable 'endstr' [-Wunused-variable]
804 | const char *endstr;
| ^~~~~~
vim +/unsigned +775 kernel/kallsyms.c
755
756 /* Returns space to next name. */
757 static unsigned long get_ksymbol_core(struct kallsym_iter *iter, int kallmodsyms)
758 {
759 unsigned off = iter->nameoff;
760
761 iter->exported = 0;
762 iter->value = kallsyms_sym_address(iter->pos);
763
764 iter->type = kallsyms_get_symbol_type(off);
765
766 iter->module_name[0] = '\0';
767 iter->builtin_module_names = NULL;
768
769 off = kallsyms_expand_symbol(off, iter->name, ARRAY_SIZE(iter->name));
770 #ifdef CONFIG_KALLMODSYMS
771 if (kallmodsyms) {
772 unsigned long mod_idx = (unsigned long) -1;
773
774 if (kallsyms_module_offsets)
> 775 unsigned long mod_idx = (unsigned long) -1;
776
777 if (kallsyms_module_offsets)
778 mod_idx =
779 get_builtin_module_idx(iter->value,
780 iter->hint_builtin_module_idx);
781
782 /*
783 * This is a built-in module iff the tables of built-in modules
784 * (address->module name mappings) and module names are known,
785 * and if the address was found there, and if the corresponding
786 * module index is nonzero, and iff this is a text (or weak)
787 * symbol. All other cases mean off the end of the binary or in
788 * a non-modular range in between one or more modules. (Also
789 * guard against a corrupt kallsyms_objfiles array pointing off
790 * the end of kallsyms_modules.)
791 */
792 if (kallsyms_modules != NULL && kallsyms_module_names != NULL &&
793 (iter->type == 't' || iter->type == 'T' ||
794 iter->type == 'w' || iter->type == 'W') &&
795 mod_idx != (unsigned long) -1 &&
796 kallsyms_modules[mod_idx] != 0 &&
797 kallsyms_modules[mod_idx] < kallsyms_module_names_len) {
798 /*
799 * Rule out (rare) section start/end symbols which might
800 * overlap the last symbol in .text. (Will also hit at most
801 * one symbol which really is in a built-in module, but only
802 * if that symbol is zero-length.)
803 */
804 const char *endstr;
805
> 806 if (likely(iter->value != &_etext))
807 iter->builtin_module_names =
808 &kallsyms_module_names[kallsyms_modules[mod_idx]];
809 }
810 iter->hint_builtin_module_idx = mod_idx;
811 }
812 #endif
813 return off - iter->nameoff;
814 }
815
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx