[gustavoars-linux:for-next/kspp 5/5] kernel/debug/gdbstub.c:1049:4: warning: fallthrough annotation in unreachable code

kernel test robot
2021-07-12T10:41:27Z

[-- Attachment #1: Type: text/plain, Size: 13237 bytes --]

tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/kspp
head: cd013b8a781567829cbb0764958b640642edc6ff
commit: cd013b8a781567829cbb0764958b640642edc6ff [5/5] Makefile: Enable -Wimplicit-fallthrough for Clang
config: riscv-randconfig-r031-20210711 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=cd013b8a781567829cbb0764958b640642edc6ff
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/kspp
git checkout cd013b8a781567829cbb0764958b640642edc6ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

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 >>):

>> kernel/debug/gdbstub.c:1049:4: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
1 warning generated.

vim +1049 kernel/debug/gdbstub.c

53197fc4954924 Jason Wessel 2010-04-02 953
53197fc4954924 Jason Wessel 2010-04-02 954 /*
2bbd9b0f2b4ec0 Bhaskar Chowdhury 2021-03-17 955 * This function performs all gdbserial command processing
53197fc4954924 Jason Wessel 2010-04-02 956 */
53197fc4954924 Jason Wessel 2010-04-02 957 int gdb_serial_stub(struct kgdb_state *ks)
53197fc4954924 Jason Wessel 2010-04-02 958 {
53197fc4954924 Jason Wessel 2010-04-02 959 int error = 0;
53197fc4954924 Jason Wessel 2010-04-02 960 int tmp;
53197fc4954924 Jason Wessel 2010-04-02 961
55751145dc1e08 Jason Wessel 2010-08-05 962 /* Initialize comm buffer and globals. */
53197fc4954924 Jason Wessel 2010-04-02 963 memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer));
55751145dc1e08 Jason Wessel 2010-08-05 964 kgdb_usethread = kgdb_info[ks->cpu].task;
55751145dc1e08 Jason Wessel 2010-08-05 965 ks->kgdb_usethreadid = shadow_pid(kgdb_info[ks->cpu].task->pid);
55751145dc1e08 Jason Wessel 2010-08-05 966 ks->pass_exception = 0;
53197fc4954924 Jason Wessel 2010-04-02 967
53197fc4954924 Jason Wessel 2010-04-02 968 if (kgdb_connected) {
84a0bd5b283072 Jason Wessel 2010-08-05 969 unsigned char thref[BUF_THREAD_ID_SIZE];
53197fc4954924 Jason Wessel 2010-04-02 970 char *ptr;
53197fc4954924 Jason Wessel 2010-04-02 971
53197fc4954924 Jason Wessel 2010-04-02 972 /* Reply to host that an exception has occurred */
53197fc4954924 Jason Wessel 2010-04-02 973 ptr = remcom_out_buffer;
53197fc4954924 Jason Wessel 2010-04-02 974 *ptr++ = 'T';
50e1499f468fd7 Andy Shevchenko 2011-10-31 975 ptr = hex_byte_pack(ptr, ks->signo);
53197fc4954924 Jason Wessel 2010-04-02 976 ptr += strlen(strcpy(ptr, "thread:"));
53197fc4954924 Jason Wessel 2010-04-02 977 int_to_threadref(thref, shadow_pid(current->pid));
53197fc4954924 Jason Wessel 2010-04-02 978 ptr = pack_threadid(ptr, thref);
53197fc4954924 Jason Wessel 2010-04-02 979 *ptr++ = ';';
53197fc4954924 Jason Wessel 2010-04-02 980 put_packet(remcom_out_buffer);
53197fc4954924 Jason Wessel 2010-04-02 981 }
53197fc4954924 Jason Wessel 2010-04-02 982
53197fc4954924 Jason Wessel 2010-04-02 983 while (1) {
53197fc4954924 Jason Wessel 2010-04-02 984 error = 0;
53197fc4954924 Jason Wessel 2010-04-02 985
53197fc4954924 Jason Wessel 2010-04-02 986 /* Clear the out buffer. */
53197fc4954924 Jason Wessel 2010-04-02 987 memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer));
53197fc4954924 Jason Wessel 2010-04-02 988
53197fc4954924 Jason Wessel 2010-04-02 989 get_packet(remcom_in_buffer);
53197fc4954924 Jason Wessel 2010-04-02 990
53197fc4954924 Jason Wessel 2010-04-02 991 switch (remcom_in_buffer[0]) {
53197fc4954924 Jason Wessel 2010-04-02 992 case '?': /* gdbserial status */
53197fc4954924 Jason Wessel 2010-04-02 993 gdb_cmd_status(ks);
53197fc4954924 Jason Wessel 2010-04-02 994 break;
53197fc4954924 Jason Wessel 2010-04-02 995 case 'g': /* return the value of the CPU registers */
53197fc4954924 Jason Wessel 2010-04-02 996 gdb_cmd_getregs(ks);
53197fc4954924 Jason Wessel 2010-04-02 997 break;
53197fc4954924 Jason Wessel 2010-04-02 998 case 'G': /* set the value of the CPU registers - return OK */
53197fc4954924 Jason Wessel 2010-04-02 999 gdb_cmd_setregs(ks);
53197fc4954924 Jason Wessel 2010-04-02 1000 break;
53197fc4954924 Jason Wessel 2010-04-02 1001 case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
53197fc4954924 Jason Wessel 2010-04-02 1002 gdb_cmd_memread(ks);
53197fc4954924 Jason Wessel 2010-04-02 1003 break;
53197fc4954924 Jason Wessel 2010-04-02 1004 case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA..AA */
53197fc4954924 Jason Wessel 2010-04-02 1005 gdb_cmd_memwrite(ks);
53197fc4954924 Jason Wessel 2010-04-02 1006 break;
55751145dc1e08 Jason Wessel 2010-08-05 1007 #if DBG_MAX_REG_NUM > 0
55751145dc1e08 Jason Wessel 2010-08-05 1008 case 'p': /* pXX Return gdb register XX (in hex) */
55751145dc1e08 Jason Wessel 2010-08-05 1009 gdb_cmd_reg_get(ks);
55751145dc1e08 Jason Wessel 2010-08-05 1010 break;
55751145dc1e08 Jason Wessel 2010-08-05 1011 case 'P': /* PXX=aaaa Set gdb register XX to aaaa (in hex) */
55751145dc1e08 Jason Wessel 2010-08-05 1012 gdb_cmd_reg_set(ks);
55751145dc1e08 Jason Wessel 2010-08-05 1013 break;
55751145dc1e08 Jason Wessel 2010-08-05 1014 #endif /* DBG_MAX_REG_NUM > 0 */
53197fc4954924 Jason Wessel 2010-04-02 1015 case 'X': /* XAA..AA,LLLL: Write LLLL bytes at address AA..AA */
53197fc4954924 Jason Wessel 2010-04-02 1016 gdb_cmd_binwrite(ks);
53197fc4954924 Jason Wessel 2010-04-02 1017 break;
53197fc4954924 Jason Wessel 2010-04-02 1018 /* kill or detach. KGDB should treat this like a
53197fc4954924 Jason Wessel 2010-04-02 1019 * continue.
53197fc4954924 Jason Wessel 2010-04-02 1020 */
53197fc4954924 Jason Wessel 2010-04-02 1021 case 'D': /* Debugger detach */
53197fc4954924 Jason Wessel 2010-04-02 1022 case 'k': /* Debugger detach via kill */
53197fc4954924 Jason Wessel 2010-04-02 1023 gdb_cmd_detachkill(ks);
53197fc4954924 Jason Wessel 2010-04-02 1024 goto default_handle;
53197fc4954924 Jason Wessel 2010-04-02 1025 case 'R': /* Reboot */
53197fc4954924 Jason Wessel 2010-04-02 1026 if (gdb_cmd_reboot(ks))
53197fc4954924 Jason Wessel 2010-04-02 1027 goto default_handle;
53197fc4954924 Jason Wessel 2010-04-02 1028 break;
53197fc4954924 Jason Wessel 2010-04-02 1029 case 'q': /* query command */
53197fc4954924 Jason Wessel 2010-04-02 1030 gdb_cmd_query(ks);
53197fc4954924 Jason Wessel 2010-04-02 1031 break;
53197fc4954924 Jason Wessel 2010-04-02 1032 case 'H': /* task related */
53197fc4954924 Jason Wessel 2010-04-02 1033 gdb_cmd_task(ks);
53197fc4954924 Jason Wessel 2010-04-02 1034 break;
53197fc4954924 Jason Wessel 2010-04-02 1035 case 'T': /* Query thread status */
53197fc4954924 Jason Wessel 2010-04-02 1036 gdb_cmd_thread(ks);
53197fc4954924 Jason Wessel 2010-04-02 1037 break;
53197fc4954924 Jason Wessel 2010-04-02 1038 case 'z': /* Break point remove */
53197fc4954924 Jason Wessel 2010-04-02 1039 case 'Z': /* Break point set */
53197fc4954924 Jason Wessel 2010-04-02 1040 gdb_cmd_break(ks);
53197fc4954924 Jason Wessel 2010-04-02 1041 break;
dcc7871128e994 Jason Wessel 2010-05-20 1042 #ifdef CONFIG_KGDB_KDB
dcc7871128e994 Jason Wessel 2010-05-20 1043 case '3': /* Escape into back into kdb */
dcc7871128e994 Jason Wessel 2010-05-20 1044 if (remcom_in_buffer[1] == '\0') {
dcc7871128e994 Jason Wessel 2010-05-20 1045 gdb_cmd_detachkill(ks);
dcc7871128e994 Jason Wessel 2010-05-20 1046 return DBG_PASS_EVENT;
dcc7871128e994 Jason Wessel 2010-05-20 1047 }
dcc7871128e994 Jason Wessel 2010-05-20 1048 #endif
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 @1049 fallthrough;
53197fc4954924 Jason Wessel 2010-04-02 1050 case 'C': /* Exception passing */
53197fc4954924 Jason Wessel 2010-04-02 1051 tmp = gdb_cmd_exception_pass(ks);
53197fc4954924 Jason Wessel 2010-04-02 1052 if (tmp > 0)
53197fc4954924 Jason Wessel 2010-04-02 1053 goto default_handle;
53197fc4954924 Jason Wessel 2010-04-02 1054 if (tmp == 0)
53197fc4954924 Jason Wessel 2010-04-02 1055 break;
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 1056 fallthrough; /* on tmp < 0 */
53197fc4954924 Jason Wessel 2010-04-02 1057 case 'c': /* Continue packet */
53197fc4954924 Jason Wessel 2010-04-02 1058 case 's': /* Single step packet */
53197fc4954924 Jason Wessel 2010-04-02 1059 if (kgdb_contthread && kgdb_contthread != current) {
53197fc4954924 Jason Wessel 2010-04-02 1060 /* Can't switch threads in kgdb */
53197fc4954924 Jason Wessel 2010-04-02 1061 error_packet(remcom_out_buffer, -EINVAL);
53197fc4954924 Jason Wessel 2010-04-02 1062 break;
53197fc4954924 Jason Wessel 2010-04-02 1063 }
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 1064 fallthrough; /* to default processing */
53197fc4954924 Jason Wessel 2010-04-02 1065 default:
53197fc4954924 Jason Wessel 2010-04-02 1066 default_handle:
53197fc4954924 Jason Wessel 2010-04-02 1067 error = kgdb_arch_handle_exception(ks->ex_vector,
53197fc4954924 Jason Wessel 2010-04-02 1068 ks->signo,
53197fc4954924 Jason Wessel 2010-04-02 1069 ks->err_code,
53197fc4954924 Jason Wessel 2010-04-02 1070 remcom_in_buffer,
53197fc4954924 Jason Wessel 2010-04-02 1071 remcom_out_buffer,
53197fc4954924 Jason Wessel 2010-04-02 1072 ks->linux_regs);
53197fc4954924 Jason Wessel 2010-04-02 1073 /*
53197fc4954924 Jason Wessel 2010-04-02 1074 * Leave cmd processing on error, detach,
53197fc4954924 Jason Wessel 2010-04-02 1075 * kill, continue, or single step.
53197fc4954924 Jason Wessel 2010-04-02 1076 */
53197fc4954924 Jason Wessel 2010-04-02 1077 if (error >= 0 || remcom_in_buffer[0] == 'D' ||
53197fc4954924 Jason Wessel 2010-04-02 1078 remcom_in_buffer[0] == 'k') {
53197fc4954924 Jason Wessel 2010-04-02 1079 error = 0;
53197fc4954924 Jason Wessel 2010-04-02 1080 goto kgdb_exit;
53197fc4954924 Jason Wessel 2010-04-02 1081 }
53197fc4954924 Jason Wessel 2010-04-02 1082
53197fc4954924 Jason Wessel 2010-04-02 1083 }
53197fc4954924 Jason Wessel 2010-04-02 1084
53197fc4954924 Jason Wessel 2010-04-02 1085 /* reply to the request */
53197fc4954924 Jason Wessel 2010-04-02 1086 put_packet(remcom_out_buffer);
53197fc4954924 Jason Wessel 2010-04-02 1087 }
53197fc4954924 Jason Wessel 2010-04-02 1088
53197fc4954924 Jason Wessel 2010-04-02 1089 kgdb_exit:
53197fc4954924 Jason Wessel 2010-04-02 1090 if (ks->pass_exception)
53197fc4954924 Jason Wessel 2010-04-02 1091 error = 1;
53197fc4954924 Jason Wessel 2010-04-02 1092 return error;
53197fc4954924 Jason Wessel 2010-04-02 1093 }
dcc7871128e994 Jason Wessel 2010-05-20 1094

:::::: The code at line 1049 was first introduced by commit
:::::: df561f6688fef775baa341a0f5d960becd248b11 treewide: Use fallthrough pseudo-keyword

:::::: TO: Gustavo A. R. Silva <gustavoars@kernel.org>
:::::: CC: Gustavo A. R. Silva <gustavoars@kernel.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38504 bytes --]