diff mbox series

[v2] Revert "kbuild: Do not enable -Wimplicit-fallthrough for clang for now"

Message ID 20201107084525.3417278-1-ndesaulniers@google.com (mailing list archive)
State New, archived
Headers show
Series [v2] Revert "kbuild: Do not enable -Wimplicit-fallthrough for clang for now" | expand

Commit Message

Nick Desaulniers Nov. 7, 2020, 8:45 a.m. UTC
This reverts commit e2079e93f562c7f7a030eb7642017ee5eabaaa10.

This has been fixed up over time thanks to the addition of "fallthrough"
pseudo-keyword in
commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo
keyword for switch/case use")

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V1 -> V2:
* We actually want a revert, not a partial revert. v1 removed
  -Wimplicit-fallthrough outright, which we don't want. We still need
  cc-option for GCC < 7.

 Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Nick Desaulniers Nov. 7, 2020, 9:04 a.m. UTC | #1
On Sat, Nov 7, 2020 at 12:45 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> This reverts commit e2079e93f562c7f7a030eb7642017ee5eabaaa10.
>
> This has been fixed up over time thanks to the addition of "fallthrough"
> pseudo-keyword in
> commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo
> keyword for switch/case use")
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes V1 -> V2:
> * We actually want a revert, not a partial revert. v1 removed
>   -Wimplicit-fallthrough outright, which we don't want. We still need
>   cc-option for GCC < 7.

Gah, I tested a ton of configs with V1...but not V2...this patch is
not ready yet. Sorry for the noise.
kernel test robot Nov. 9, 2020, 9:33 a.m. UTC | #2
Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kbuild/for-next]
[also build test WARNING on v5.10-rc3 next-20201109]
[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/Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
config: powerpc64-randconfig-r014-20201109 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 09ec07827b1128504457a93dee80b2ceee1af600)
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
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/0day-ci/linux/commit/8b3537ff657d0124d47fbe215decbba65c4551ff
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
        git checkout 8b3537ff657d0124d47fbe215decbba65c4551ff
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

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

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/amdgpu/vi.c:24:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:29:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> drivers/gpu/drm/amd/amdgpu/vi.c:1648:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/vi.c:1648:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   3 warnings generated.
--
   In file included from drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:25:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:29:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:505:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:505:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:382:23: warning: unused variable 'ecc_umc_mcumc_status_addrs' [-Wunused-const-variable]
   static const uint32_t ecc_umc_mcumc_status_addrs[] = {
                         ^
   4 warnings generated.
--
   In file included from drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:28:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:29:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2985:6: warning: no previous prototype for function 'gfx_v9_0_rlc_stop' [-Wmissing-prototypes]
   void gfx_v9_0_rlc_stop(struct amdgpu_device *adev)
        ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2985:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void gfx_v9_0_rlc_stop(struct amdgpu_device *adev)
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:5676:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:5676:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   4 warnings generated.
--
   In file included from drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:28:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:29:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4863:6: warning: no previous prototype for function 'gfx_v10_0_rlc_stop' [-Wmissing-prototypes]
   void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
        ^
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4863:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:8397:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:8397:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   4 warnings generated.
--
   In file included from drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:24:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:29:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:2045:5: warning: no previous prototype for function 'polaris10_thermal_avfs_enable' [-Wmissing-prototypes]
   int polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr)
       ^
   drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:2045:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr)
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:2275:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/../pm/powerplay/smumgr/polaris10_smumgr.c:2275:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   4 warnings generated.
--
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:28:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:30:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:29:
   In file included from include/linux/ftrace.h:11:
   In file included from include/linux/kallsyms.h:12:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:1201:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:1201:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:2587:16: warning: no previous prototype for function 'update_slot_layout_info' [-Wmissing-prototypes]
   enum bp_result update_slot_layout_info(
                  ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:2587:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   enum bp_result update_slot_layout_info(
   ^
   static 
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:2691:16: warning: no previous prototype for function 'get_bracket_layout_record' [-Wmissing-prototypes]
   enum bp_result get_bracket_layout_record(
                  ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser.c:2691:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   enum bp_result get_bracket_layout_record(
   ^
   static 
   5 warnings generated.
..

vim +1648 drivers/gpu/drm/amd/amdgpu/vi.c

1bb08f91b0f6b2d Rex Zhu         2016-09-18  1611  
5fc3aeeb9e553a2 yanyang1        2015-05-22  1612  static int vi_common_set_clockgating_state(void *handle,
5fc3aeeb9e553a2 yanyang1        2015-05-22  1613  					   enum amd_clockgating_state state)
aaa36a976bbb9b0 Alex Deucher    2015-04-20  1614  {
6cec2655fa988b4 Eric Huang      2015-11-12  1615  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
6cec2655fa988b4 Eric Huang      2015-11-12  1616  
ce137c04ff4bb78 Monk Liu        2017-01-23  1617  	if (amdgpu_sriov_vf(adev))
ce137c04ff4bb78 Monk Liu        2017-01-23  1618  		return 0;
ce137c04ff4bb78 Monk Liu        2017-01-23  1619  
6cec2655fa988b4 Eric Huang      2015-11-12  1620  	switch (adev->asic_type) {
6cec2655fa988b4 Eric Huang      2015-11-12  1621  	case CHIP_FIJI:
76f10b9adae111d Alex Deucher    2016-04-08  1622  		vi_update_bif_medium_grain_light_sleep(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1623  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1624  		vi_update_hdp_medium_grain_clock_gating(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1625  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1626  		vi_update_hdp_light_sleep(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1627  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1628  		vi_update_rom_medium_grain_clock_gating(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1629  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1630  		break;
76f10b9adae111d Alex Deucher    2016-04-08  1631  	case CHIP_CARRIZO:
76f10b9adae111d Alex Deucher    2016-04-08  1632  	case CHIP_STONEY:
76f10b9adae111d Alex Deucher    2016-04-08  1633  		vi_update_bif_medium_grain_light_sleep(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1634  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1635  		vi_update_hdp_medium_grain_clock_gating(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1636  				state == AMD_CG_STATE_GATE);
76f10b9adae111d Alex Deucher    2016-04-08  1637  		vi_update_hdp_light_sleep(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1638  				state == AMD_CG_STATE_GATE);
f6f534e2af5b518 Rex Zhu         2016-12-08  1639  		vi_update_drm_light_sleep(adev,
7e91366420554e7 Andrew F. Davis 2017-03-15  1640  				state == AMD_CG_STATE_GATE);
6cec2655fa988b4 Eric Huang      2015-11-12  1641  		break;
1bb08f91b0f6b2d Rex Zhu         2016-09-18  1642  	case CHIP_TONGA:
1bb08f91b0f6b2d Rex Zhu         2016-09-18  1643  	case CHIP_POLARIS10:
1bb08f91b0f6b2d Rex Zhu         2016-09-18  1644  	case CHIP_POLARIS11:
c4642a479fac9f5 Junwei Zhang    2016-12-14  1645  	case CHIP_POLARIS12:
b51c5194a5b8d78 Leo Liu         2018-04-11  1646  	case CHIP_VEGAM:
1bb08f91b0f6b2d Rex Zhu         2016-09-18  1647  		vi_common_set_clockgating_state_by_smu(adev, state);
6cec2655fa988b4 Eric Huang      2015-11-12 @1648  	default:
6cec2655fa988b4 Eric Huang      2015-11-12  1649  		break;
6cec2655fa988b4 Eric Huang      2015-11-12  1650  	}
aaa36a976bbb9b0 Alex Deucher    2015-04-20  1651  	return 0;
aaa36a976bbb9b0 Alex Deucher    2015-04-20  1652  }
aaa36a976bbb9b0 Alex Deucher    2015-04-20  1653  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Nov. 9, 2020, 10:42 a.m. UTC | #3
Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kbuild/for-next]
[also build test WARNING on v5.10-rc3 next-20201109]
[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/Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
config: powerpc64-randconfig-r016-20201109 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 09ec07827b1128504457a93dee80b2ceee1af600)
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
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/0day-ci/linux/commit/8b3537ff657d0124d47fbe215decbba65c4551ff
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
        git checkout 8b3537ff657d0124d47fbe215decbba65c4551ff
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

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

All warnings (new ones prefixed by >>):

   In file included from security/integrity/ima/ima_main.c:23:
   In file included from include/linux/mman.h:5:
   In file included from include/linux/mm.h:687:
   In file included from include/linux/huge_mm.h:8:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> security/integrity/ima/ima_main.c:746:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   security/integrity/ima/ima_main.c:746:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   3 warnings generated.
--
   In file included from security/integrity/ima/ima_policy.c:13:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> security/integrity/ima/ima_policy.c:569:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
                   default:
                   ^
   security/integrity/ima/ima_policy.c:569:3: note: insert 'break;' to avoid fall-through
                   default:
                   ^
                   break; 
   security/integrity/ima/ima_policy.c:805:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   security/integrity/ima/ima_policy.c:805:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   4 warnings generated.
--
   In file included from drivers/mmc/host/sdhci-of-arasan.c:22:
   In file included from include/linux/phy/phy.h:17:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:17:
   In file included from include/linux/fs.h:33:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
   include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 1: ;
           ^
   include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 1: ;
           ^
           __attribute__((fallthrough)); 
   include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
           case 1: ;
           ^
           break; 
>> drivers/mmc/host/sdhci-of-arasan.c:630:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/mmc/host/sdhci-of-arasan.c:630:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   drivers/mmc/host/sdhci-of-arasan.c:698:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/mmc/host/sdhci-of-arasan.c:698:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   drivers/mmc/host/sdhci-of-arasan.c:763:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/mmc/host/sdhci-of-arasan.c:763:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   drivers/mmc/host/sdhci-of-arasan.c:834:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           default:
           ^
   drivers/mmc/host/sdhci-of-arasan.c:834:2: note: insert 'break;' to avoid fall-through
           default:
           ^
           break; 
   6 warnings generated.
--
>> lib/siphash.c:72:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
   lib/siphash.c:72:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:72:2: note: insert 'break;' to avoid fall-through
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
           break; 
   lib/siphash.c:73:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
   lib/siphash.c:73:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:73:2: note: insert 'break;' to avoid fall-through
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
           break; 
   lib/siphash.c:74:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 4: b |= le32_to_cpup(data); break;
           ^
   lib/siphash.c:74:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 4: b |= le32_to_cpup(data); break;
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:74:2: note: insert 'break;' to avoid fall-through
           case 4: b |= le32_to_cpup(data); break;
           ^
           break; 
   lib/siphash.c:76:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 2: b |= le16_to_cpup(data); break;
           ^
   lib/siphash.c:76:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 2: b |= le16_to_cpup(data); break;
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:76:2: note: insert 'break;' to avoid fall-through
           case 2: b |= le16_to_cpup(data); break;
           ^
           break; 
   lib/siphash.c:272:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
   lib/siphash.c:272:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:272:2: note: insert 'break;' to avoid fall-through
           case 6: b |= ((u64)end[5]) << 40; /* fall through */
           ^
           break; 
   lib/siphash.c:273:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
   lib/siphash.c:273:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:273:2: note: insert 'break;' to avoid fall-through
           case 5: b |= ((u64)end[4]) << 32; /* fall through */
           ^
           break; 
   lib/siphash.c:274:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 4: b |= le32_to_cpup(data); break;
           ^
   lib/siphash.c:274:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 4: b |= le32_to_cpup(data); break;
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:274:2: note: insert 'break;' to avoid fall-through
           case 4: b |= le32_to_cpup(data); break;
           ^
           break; 
   lib/siphash.c:276:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
           case 2: b |= le16_to_cpup(data); break;
           ^
   lib/siphash.c:276:2: note: insert '__attribute__((fallthrough));' to silence this warning
           case 2: b |= le16_to_cpup(data); break;
           ^
           __attribute__((fallthrough)); 
   lib/siphash.c:276:2: note: insert 'break;' to avoid fall-through
           case 2: b |= le16_to_cpup(data); break;
           ^
           break; 
   8 warnings generated.

vim +746 security/integrity/ima/ima_main.c

5a9196d715607f7 Mimi Zohar 2014-07-22  699  
16c267aac86b463 Mimi Zohar 2018-07-13  700  /**
16c267aac86b463 Mimi Zohar 2018-07-13  701   * ima_load_data - appraise decision based on policy
16c267aac86b463 Mimi Zohar 2018-07-13  702   * @id: kernel load data caller identifier
b64fcae74b6d694 Kees Cook  2020-10-02  703   * @contents: whether the full contents will be available in a later
b64fcae74b6d694 Kees Cook  2020-10-02  704   *	      call to ima_post_load_data().
16c267aac86b463 Mimi Zohar 2018-07-13  705   *
16c267aac86b463 Mimi Zohar 2018-07-13  706   * Callers of this LSM hook can not measure, appraise, or audit the
16c267aac86b463 Mimi Zohar 2018-07-13  707   * data provided by userspace.  Enforce policy rules requring a file
16c267aac86b463 Mimi Zohar 2018-07-13  708   * signature (eg. kexec'ed kernel image).
16c267aac86b463 Mimi Zohar 2018-07-13  709   *
16c267aac86b463 Mimi Zohar 2018-07-13  710   * For permission return 0, otherwise return -EACCES.
16c267aac86b463 Mimi Zohar 2018-07-13  711   */
b64fcae74b6d694 Kees Cook  2020-10-02  712  int ima_load_data(enum kernel_load_data_id id, bool contents)
16c267aac86b463 Mimi Zohar 2018-07-13  713  {
b5ca117365d960f Nayna Jain 2018-10-09  714  	bool ima_enforce, sig_enforce;
c77b8cdf745d91e Mimi Zohar 2018-07-13  715  
b5ca117365d960f Nayna Jain 2018-10-09  716  	ima_enforce =
b5ca117365d960f Nayna Jain 2018-10-09  717  		(ima_appraise & IMA_APPRAISE_ENFORCE) == IMA_APPRAISE_ENFORCE;
16c267aac86b463 Mimi Zohar 2018-07-13  718  
16c267aac86b463 Mimi Zohar 2018-07-13  719  	switch (id) {
16c267aac86b463 Mimi Zohar 2018-07-13  720  	case LOADING_KEXEC_IMAGE:
99d5cadfde2b1ac Jiri Bohac 2019-08-19  721  		if (IS_ENABLED(CONFIG_KEXEC_SIG)
b5ca117365d960f Nayna Jain 2018-10-09  722  		    && arch_ima_get_secureboot()) {
b5ca117365d960f Nayna Jain 2018-10-09  723  			pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n");
b5ca117365d960f Nayna Jain 2018-10-09  724  			return -EACCES;
b5ca117365d960f Nayna Jain 2018-10-09  725  		}
b5ca117365d960f Nayna Jain 2018-10-09  726  
b5ca117365d960f Nayna Jain 2018-10-09  727  		if (ima_enforce && (ima_appraise & IMA_APPRAISE_KEXEC)) {
16c267aac86b463 Mimi Zohar 2018-07-13  728  			pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n");
16c267aac86b463 Mimi Zohar 2018-07-13  729  			return -EACCES;	/* INTEGRITY_UNKNOWN */
16c267aac86b463 Mimi Zohar 2018-07-13  730  		}
fed2512a7ccc8fc Mimi Zohar 2018-07-13  731  		break;
fed2512a7ccc8fc Mimi Zohar 2018-07-13  732  	case LOADING_FIRMWARE:
4f2d99b06b73800 Kees Cook  2020-10-02  733  		if (ima_enforce && (ima_appraise & IMA_APPRAISE_FIRMWARE) && !contents) {
fed2512a7ccc8fc Mimi Zohar 2018-07-13  734  			pr_err("Prevent firmware sysfs fallback loading.\n");
fed2512a7ccc8fc Mimi Zohar 2018-07-13  735  			return -EACCES;	/* INTEGRITY_UNKNOWN */
fed2512a7ccc8fc Mimi Zohar 2018-07-13  736  		}
c77b8cdf745d91e Mimi Zohar 2018-07-13  737  		break;
c77b8cdf745d91e Mimi Zohar 2018-07-13  738  	case LOADING_MODULE:
c77b8cdf745d91e Mimi Zohar 2018-07-13  739  		sig_enforce = is_module_sig_enforced();
c77b8cdf745d91e Mimi Zohar 2018-07-13  740  
b5ca117365d960f Nayna Jain 2018-10-09  741  		if (ima_enforce && (!sig_enforce
b5ca117365d960f Nayna Jain 2018-10-09  742  				    && (ima_appraise & IMA_APPRAISE_MODULES))) {
c77b8cdf745d91e Mimi Zohar 2018-07-13  743  			pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
c77b8cdf745d91e Mimi Zohar 2018-07-13  744  			return -EACCES;	/* INTEGRITY_UNKNOWN */
c77b8cdf745d91e Mimi Zohar 2018-07-13  745  		}
16c267aac86b463 Mimi Zohar 2018-07-13 @746  	default:
16c267aac86b463 Mimi Zohar 2018-07-13  747  		break;
16c267aac86b463 Mimi Zohar 2018-07-13  748  	}
16c267aac86b463 Mimi Zohar 2018-07-13  749  	return 0;
16c267aac86b463 Mimi Zohar 2018-07-13  750  }
16c267aac86b463 Mimi Zohar 2018-07-13  751  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f353886dbf44..3edce16daede 100644
--- a/Makefile
+++ b/Makefile
@@ -777,11 +777,6 @@  else
 # These warnings generated too much noise in a regular build.
 # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
 KBUILD_CFLAGS += -Wno-unused-but-set-variable
-
-# Warn about unmarked fall-throughs in switch statement.
-# Disabled for clang while comment to attribute conversion happens and
-# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed.
-KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
 endif
 
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
@@ -905,6 +900,9 @@  NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 # warn about C99 declaration after statement
 KBUILD_CFLAGS += -Wdeclaration-after-statement
 
+# Warn about unmarked fall-throughs in switch statement.
+KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
+
 # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
 KBUILD_CFLAGS += -Wvla