CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Vincent Mailhol <[email protected]> CC: "Marc Kleine-Budde" <[email protected]> CC: Arunachalam Santhanam <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: ae085d7f9365de7da27ab5c0d16b12d51ea7fca9 commit: 8537257874e949a59c834cecfd5a063e11b64b0b can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces date: 12 months ago :::::: branch date: 7 hours ago :::::: commit date: 12 months ago config: riscv-randconfig-c006-20220327 (https://download.01.org/0day-ci/archive/20220328/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d) 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/torvalds/linux.git/commit/?id=8537257874e949a59c834cecfd5a063e11b64b0b git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 8537257874e949a59c834cecfd5a063e11b64b0b # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ drivers/media/i2c/ov7670.c:1619:7: note: Assuming field 'val' is equal to V4L2_EXPOSURE_MANUAL if (ctrl->val == V4L2_EXPOSURE_MANUAL) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:1619:3: note: Taking true branch if (ctrl->val == V4L2_EXPOSURE_MANUAL) { ^ drivers/media/i2c/ov7670.c:1621:11: note: Calling 'ov7670_s_exp' return ov7670_s_exp(sd, info->exposure->val); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:1519:34: note: 'aechh' declared without an initial value unsigned char com1, com8, aech, aechh; ^~~~~ drivers/media/i2c/ov7670.c:1523:3: note: Calling 'ov7670_read' ov7670_read(sd, REG_AECHH, &aechh); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:565:12: note: Field 'use_smbus' is true if (info->use_smbus) ^ drivers/media/i2c/ov7670.c:565:2: note: Taking true branch if (info->use_smbus) ^ drivers/media/i2c/ov7670.c:566:10: note: Calling 'ov7670_read_smbus' return ov7670_read_smbus(sd, reg, value); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:485:6: note: Assuming 'ret' is < 0 if (ret >= 0) { ^~~~~~~~ drivers/media/i2c/ov7670.c:485:2: note: Taking false branch if (ret >= 0) { ^ drivers/media/i2c/ov7670.c:489:2: note: Returning without writing to '*value' return ret; ^ drivers/media/i2c/ov7670.c:566:10: note: Returning from 'ov7670_read_smbus' return ov7670_read_smbus(sd, reg, value); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:566:3: note: Returning without writing to '*value' return ov7670_read_smbus(sd, reg, value); ^ drivers/media/i2c/ov7670.c:1523:3: note: Returning from 'ov7670_read' ov7670_read(sd, REG_AECHH, &aechh); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/ov7670.c:1524:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/media/i2c/ov7670.c:1524:2: note: Taking false branch if (ret) ^ drivers/media/i2c/ov7670.c:1529:17: note: The left operand of '&' is a garbage value aechh = (aechh & 0xc0) | ((value >> 10) & 0x3f); ~~~~~ ^ Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] netdev->stats.rx_bytes += cf->can_dlc; ^~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:649:6: note: Assuming the condition is false if (!netif_running(netdev)) { ^~~~~~~~~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:649:2: note: Taking false branch if (!netif_running(netdev)) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:657:6: note: Assuming 'error' is not equal to ES58X_ERR_OK if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) { ^~~~~~~~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:657:28: note: Left side of '&&' is false if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:663:8: note: Value assigned to 'cf' skb = alloc_can_err_skb(netdev, &cf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:665:2: note: Control jumps to 'case ES58X_ERR_PROT_UNSPEC:' at line 727 switch (error) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:728:7: note: Assuming the condition is false if (net_ratelimit()) ^~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:728:3: note: Taking false branch if (net_ratelimit()) ^ drivers/net/can/usb/etas_es58x/es58x_core.c:730:7: note: Assuming 'cf' is null if (cf) ^~ drivers/net/can/usb/etas_es58x/es58x_core.c:730:3: note: Taking false branch if (cf) ^ drivers/net/can/usb/etas_es58x/es58x_core.c:732:3: note: Execution continues on line 744 break; ^ drivers/net/can/usb/etas_es58x/es58x_core.c:744:2: note: Control jumps to 'case ES58X_EVENT_OK:' at line 745 switch (event) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:746:3: note: Execution continues on line 838 break; ^ drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: note: Dereference of null pointer netdev->stats.rx_bytes += cf->can_dlc; ^~~~~~~~~~~ >> drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored >> to 'dev' during its initialization is never read >> [clang-analyzer-deadcode.DeadStores] const struct device *dev = es58x_dev->dev; ^~~ ~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: note: Value stored to 'dev' during its initialization is never read const struct device *dev = es58x_dev->dev; ^~~ ~~~~~~~~~~~~~~ Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. drivers/dma-buf/dma-resv.c:507:26: warning: Array access (from variable 'shared') results in a null pointer dereference [clang-analyzer-core.NullDereference] shared[shared_count++] = fence_excl; ~~~~~~ ^ drivers/dma-buf/dma-resv.c:437:2: note: 'shared' initialized to a null pointer value struct dma_fence **shared = NULL; ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/dma-buf/dma-resv.c:450:9: note: Loop condition is false. Execution continues on line 450 seq = read_seqcount_begin(&obj->seq); ^ include/linux/seqlock.h:363:2: note: expanded from macro 'read_seqcount_begin' raw_read_seqcount_begin(s); \ ^ include/linux/seqlock.h:348:18: note: expanded from macro 'raw_read_seqcount_begin' unsigned _seq = __read_seqcount_begin(s); \ ^ include/linux/seqlock.h:333:2: note: expanded from macro '__read_seqcount_begin' while ((__seq = seqprop_sequence(s)) & 1) \ ^ drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false fence_excl = rcu_dereference(obj->fence_excl); ^ include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference' #define rcu_dereference(p) rcu_dereference_check(p, 0) ^ include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check' __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu) ^ include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check' typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \ ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false fence_excl = rcu_dereference(obj->fence_excl); ^ include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference' #define rcu_dereference(p) rcu_dereference_check(p, 0) ^ include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check' __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu) ^ include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check' typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \ ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is true fence_excl = rcu_dereference(obj->fence_excl); ^ include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference' #define rcu_dereference(p) rcu_dereference_check(p, 0) ^ include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check' __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu) ^ include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check' typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \ ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ vim +/dev +1158 drivers/net/can/usb/etas_es58x/es58x_core.c 8537257874e949 Vincent Mailhol 2021-04-10 1132 8537257874e949 Vincent Mailhol 2021-04-10 1133 /** 8537257874e949 Vincent Mailhol 2021-04-10 1134 * es58x_check_rx_urb() - Check the length and format of the URB command. 8537257874e949 Vincent Mailhol 2021-04-10 1135 * @es58x_dev: ES58X device. 8537257874e949 Vincent Mailhol 2021-04-10 1136 * @urb_cmd: The URB command received from the ES58X device, might not 8537257874e949 Vincent Mailhol 2021-04-10 1137 * be aligned. 8537257874e949 Vincent Mailhol 2021-04-10 1138 * @urb_actual_len: The actual length of the URB command. 8537257874e949 Vincent Mailhol 2021-04-10 1139 * 8537257874e949 Vincent Mailhol 2021-04-10 1140 * Check if the first message of the received urb is valid, that is to 8537257874e949 Vincent Mailhol 2021-04-10 1141 * say that both the header and the length are coherent. 8537257874e949 Vincent Mailhol 2021-04-10 1142 * 8537257874e949 Vincent Mailhol 2021-04-10 1143 * Return: 8537257874e949 Vincent Mailhol 2021-04-10 1144 * the length of the first message of the URB on success. 8537257874e949 Vincent Mailhol 2021-04-10 1145 * 8537257874e949 Vincent Mailhol 2021-04-10 1146 * -ENODATA if the URB command is incomplete (in which case, the URB 8537257874e949 Vincent Mailhol 2021-04-10 1147 * command should be buffered and combined with the next URB to try to 8537257874e949 Vincent Mailhol 2021-04-10 1148 * reconstitute the URB command). 8537257874e949 Vincent Mailhol 2021-04-10 1149 * 8537257874e949 Vincent Mailhol 2021-04-10 1150 * -EOVERFLOW if the length is bigger than the maximum expected one. 8537257874e949 Vincent Mailhol 2021-04-10 1151 * 8537257874e949 Vincent Mailhol 2021-04-10 1152 * -EBADRQC if the start of frame does not match the expected value. 8537257874e949 Vincent Mailhol 2021-04-10 1153 */ 8537257874e949 Vincent Mailhol 2021-04-10 1154 static signed int es58x_check_rx_urb(struct es58x_device *es58x_dev, 8537257874e949 Vincent Mailhol 2021-04-10 1155 const union es58x_urb_cmd *urb_cmd, 8537257874e949 Vincent Mailhol 2021-04-10 1156 u32 urb_actual_len) 8537257874e949 Vincent Mailhol 2021-04-10 1157 { 8537257874e949 Vincent Mailhol 2021-04-10 @1158 const struct device *dev = es58x_dev->dev; 8537257874e949 Vincent Mailhol 2021-04-10 1159 const struct es58x_parameters *param = es58x_dev->param; 8537257874e949 Vincent Mailhol 2021-04-10 1160 u16 sof, msg_len; 8537257874e949 Vincent Mailhol 2021-04-10 1161 signed int urb_cmd_len, ret; 8537257874e949 Vincent Mailhol 2021-04-10 1162 8537257874e949 Vincent Mailhol 2021-04-10 1163 if (urb_actual_len < param->urb_cmd_header_len) { 8537257874e949 Vincent Mailhol 2021-04-10 1164 dev_vdbg(dev, 8537257874e949 Vincent Mailhol 2021-04-10 1165 "%s: Received %d bytes [%*ph]: header incomplete\n", 8537257874e949 Vincent Mailhol 2021-04-10 1166 __func__, urb_actual_len, urb_actual_len, 8537257874e949 Vincent Mailhol 2021-04-10 1167 urb_cmd->raw_cmd); 8537257874e949 Vincent Mailhol 2021-04-10 1168 return -ENODATA; 8537257874e949 Vincent Mailhol 2021-04-10 1169 } 8537257874e949 Vincent Mailhol 2021-04-10 1170 8537257874e949 Vincent Mailhol 2021-04-10 1171 sof = get_unaligned_le16(&urb_cmd->sof); 8537257874e949 Vincent Mailhol 2021-04-10 1172 if (sof != param->rx_start_of_frame) { 8537257874e949 Vincent Mailhol 2021-04-10 1173 dev_err_ratelimited(es58x_dev->dev, 8537257874e949 Vincent Mailhol 2021-04-10 1174 "%s: Expected sequence 0x%04X for start of frame but got 0x%04X.\n", 8537257874e949 Vincent Mailhol 2021-04-10 1175 __func__, param->rx_start_of_frame, sof); 8537257874e949 Vincent Mailhol 2021-04-10 1176 return -EBADRQC; 8537257874e949 Vincent Mailhol 2021-04-10 1177 } 8537257874e949 Vincent Mailhol 2021-04-10 1178 8537257874e949 Vincent Mailhol 2021-04-10 1179 msg_len = es58x_dev->ops->get_msg_len(urb_cmd); 8537257874e949 Vincent Mailhol 2021-04-10 1180 urb_cmd_len = es58x_get_urb_cmd_len(es58x_dev, msg_len); 8537257874e949 Vincent Mailhol 2021-04-10 1181 if (urb_cmd_len > param->rx_urb_cmd_max_len) { 8537257874e949 Vincent Mailhol 2021-04-10 1182 dev_err_ratelimited(es58x_dev->dev, 8537257874e949 Vincent Mailhol 2021-04-10 1183 "%s: Biggest expected size for rx urb_cmd is %u but receive a command of size %d\n", 8537257874e949 Vincent Mailhol 2021-04-10 1184 __func__, 8537257874e949 Vincent Mailhol 2021-04-10 1185 param->rx_urb_cmd_max_len, urb_cmd_len); 8537257874e949 Vincent Mailhol 2021-04-10 1186 return -EOVERFLOW; 8537257874e949 Vincent Mailhol 2021-04-10 1187 } else if (urb_actual_len < urb_cmd_len) { 8537257874e949 Vincent Mailhol 2021-04-10 1188 dev_vdbg(dev, "%s: Received %02d/%02d bytes\n", 8537257874e949 Vincent Mailhol 2021-04-10 1189 __func__, urb_actual_len, urb_cmd_len); 8537257874e949 Vincent Mailhol 2021-04-10 1190 return -ENODATA; 8537257874e949 Vincent Mailhol 2021-04-10 1191 } 8537257874e949 Vincent Mailhol 2021-04-10 1192 8537257874e949 Vincent Mailhol 2021-04-10 1193 ret = es58x_check_crc(es58x_dev, urb_cmd, urb_cmd_len); 8537257874e949 Vincent Mailhol 2021-04-10 1194 if (ret) 8537257874e949 Vincent Mailhol 2021-04-10 1195 return ret; 8537257874e949 Vincent Mailhol 2021-04-10 1196 8537257874e949 Vincent Mailhol 2021-04-10 1197 return urb_cmd_len; 8537257874e949 Vincent Mailhol 2021-04-10 1198 } 8537257874e949 Vincent Mailhol 2021-04-10 1199 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
