[PATCH] ARM: Fix incorrect use of smp_processor_id() by syzbot report

kernel test robot lkp at intel.com
Fri Mar 12 06:32:10 GMT 2021


Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master hnaz-linux-mm/master v5.12-rc2 next-20210311]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/qiang-zhang-windriver-com/ARM-Fix-incorrect-use-of-smp_processor_id-by-syzbot-report/20210312-121529
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a74e6a014c9d4d4161061f770c9b4f98372ac778
config: arm-pxa168_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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/0day-ci/linux/commit/b31b47976c6f81426cc00c99cc1452a60e89d972
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review qiang-zhang-windriver-com/ARM-Fix-incorrect-use-of-smp_processor_id-by-syzbot-report/20210312-121529
        git checkout b31b47976c6f81426cc00c99cc1452a60e89d972
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/arm/mm/fault.c:21:
   arch/arm/include/asm/system_misc.h: In function 'harden_branch_predictor':
>> arch/arm/include/asm/system_misc.h:25:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      25 |  harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mm/fault.c: At top level:
   arch/arm/mm/fault.c:518:1: warning: no previous prototype for 'do_DataAbort' [-Wmissing-prototypes]
     518 | do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
         | ^~~~~~~~~~~~
   arch/arm/mm/fault.c:548:1: warning: no previous prototype for 'do_PrefetchAbort' [-Wmissing-prototypes]
     548 | do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)
         | ^~~~~~~~~~~~~~~~
--
   In file included from arch/arm/mm/proc-v7-bugs.c:9:
   arch/arm/include/asm/system_misc.h: In function 'harden_branch_predictor':
>> arch/arm/include/asm/system_misc.h:25:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      25 |  harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/mm/proc-v7-bugs.c: At top level:
   arch/arm/mm/proc-v7-bugs.c:142:6: warning: no previous prototype for 'cpu_v7_ca8_ibe' [-Wmissing-prototypes]
     142 | void cpu_v7_ca8_ibe(void)
         |      ^~~~~~~~~~~~~~
   arch/arm/mm/proc-v7-bugs.c:148:6: warning: no previous prototype for 'cpu_v7_ca15_ibe' [-Wmissing-prototypes]
     148 | void cpu_v7_ca15_ibe(void)
         |      ^~~~~~~~~~~~~~~
   arch/arm/mm/proc-v7-bugs.c:154:6: warning: no previous prototype for 'cpu_v7_bugs_init' [-Wmissing-prototypes]
     154 | void cpu_v7_bugs_init(void)
         |      ^~~~~~~~~~~~~~~~


vim +25 arch/arm/include/asm/system_misc.h

9f97da78bf0182 David Howells 2012-03-28  18  
f5fe12b1eaee22 Russell King  2018-05-14  19  #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
f5fe12b1eaee22 Russell King  2018-05-14  20  typedef void (*harden_branch_predictor_fn_t)(void);
f5fe12b1eaee22 Russell King  2018-05-14  21  DECLARE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn);
f5fe12b1eaee22 Russell King  2018-05-14  22  static inline void harden_branch_predictor(void)
f5fe12b1eaee22 Russell King  2018-05-14  23  {
b31b47976c6f81 Zqiang        2021-03-12  24  	preempt_disable();
f5fe12b1eaee22 Russell King  2018-05-14 @25  	harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn,
f5fe12b1eaee22 Russell King  2018-05-14  26  						  smp_processor_id());
b31b47976c6f81 Zqiang        2021-03-12  27  	preempt_enable();
f5fe12b1eaee22 Russell King  2018-05-14  28  	if (fn)
f5fe12b1eaee22 Russell King  2018-05-14  29  		fn();
f5fe12b1eaee22 Russell King  2018-05-14  30  }
f5fe12b1eaee22 Russell King  2018-05-14  31  #else
f5fe12b1eaee22 Russell King  2018-05-14  32  #define harden_branch_predictor() do { } while (0)
f5fe12b1eaee22 Russell King  2018-05-14  33  #endif
f5fe12b1eaee22 Russell King  2018-05-14  34  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 12239 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210312/9805dd3e/attachment-0001.gz>


More information about the linux-arm-kernel mailing list