:::::: :::::: Manual check reason: "low confidence static check warning: drivers/net/can/usb/etas_es58x/es58x_core.c:2214:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]" :::::: BCC: lkp@intel.com CC: llvm@lists.linux.dev CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20221113040108.68249-3-mailhol.vincent@wanadoo.fr> References: <20221113040108.68249-3-mailhol.vincent@wanadoo.fr> TO: Vincent Mailhol TO: "Marc Kleine-Budde" TO: linux-can@vger.kernel.org CC: "Greg Kroah-Hartman" CC: linux-kernel@vger.kernel.org CC: netdev@vger.kernel.org CC: linux-usb@vger.kernel.org CC: Vincent Mailhol Hi Vincent, I love your patch! Perhaps something to improve: [auto build test WARNING on mkl-can-next/testing] [also build test WARNING on usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.1-rc7] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/USB-core-export-usb_cache_string/20221113-130203 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing patch link: https://lore.kernel.org/r/20221113040108.68249-3-mailhol.vincent%40wanadoo.fr patch subject: [PATCH v3 2/3] can: etas_es58x: export firmware, bootloader and hardware versions in sysfs :::::: branch date: 3 weeks ago :::::: commit date: 3 weeks ago config: arm-randconfig-c002-20221128 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) 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 arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/intel-lab-lkp/linux/commit/3d1425615e7b18818293e31283afe17e34cf31d1 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Vincent-Mailhol/USB-core-export-usb_cache_string/20221113-130203 git checkout 3d1425615e7b18818293e31283afe17e34cf31d1 # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot clang_analyzer warnings: (new ones prefixed by >>) if (ret) ^~~ drivers/usb/typec/rt1719.c:145:2: note: Taking true branch if (ret) ^ drivers/usb/typec/rt1719.c:146:3: note: Returning without writing to '*val' return ret; ^ drivers/usb/typec/rt1719.c:665:8: note: Returning from 'rt1719_read32' ret = rt1719_read32(data, RT1719_REG_POLICYINFO, &conn_info); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/typec/rt1719.c:668:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/usb/typec/rt1719.c:668:2: note: Taking false branch if (ret) ^ drivers/usb/typec/rt1719.c:671:18: note: Assigned value is garbage or undefined data->conn_info = conn_info; ^ ~~~~~~~~~ drivers/usb/typec/rt1719.c:672:18: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] data->conn_stat = conn_stat; ^ drivers/usb/typec/rt1719.c:851:6: note: Assuming 'data' is non-null if (!data) ^~~~~ drivers/usb/typec/rt1719.c:851:2: note: Taking false branch if (!data) ^ drivers/usb/typec/rt1719.c:858:2: note: Taking false branch if (IS_ERR(data->regmap)) { ^ drivers/usb/typec/rt1719.c:865:6: note: 'ret' is 0 if (ret) ^~~ drivers/usb/typec/rt1719.c:865:2: note: Taking false branch if (ret) ^ drivers/usb/typec/rt1719.c:869:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/usb/typec/rt1719.c:869:2: note: Taking false branch if (ret) ^ drivers/usb/typec/rt1719.c:873:6: note: Assuming 'fwnode' is non-null if (!fwnode) ^~~~~~~ drivers/usb/typec/rt1719.c:873:2: note: Taking false branch if (!fwnode) ^ drivers/usb/typec/rt1719.c:877:2: note: Taking false branch if (IS_ERR(data->role_sw)) { ^ drivers/usb/typec/rt1719.c:884:6: note: 'ret' is 0 if (ret) { ^~~ drivers/usb/typec/rt1719.c:884:2: note: Taking false branch if (ret) { ^ drivers/usb/typec/rt1719.c:901:2: note: Taking false branch if (IS_ERR(data->port)) { ^ drivers/usb/typec/rt1719.c:907:8: note: Calling 'rt1719_init_attach_state' ret = rt1719_init_attach_state(data); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/typec/rt1719.c:658:2: note: 'conn_stat' declared without an initial value u16 conn_stat; ^~~~~~~~~~~~~ drivers/usb/typec/rt1719.c:666:9: note: Calling 'rt1719_read16' ret |= rt1719_read16(data, RT1719_REG_STATS, &conn_stat); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/typec/rt1719.c:132:6: note: Assuming 'ret' is not equal to 0 if (ret) ^~~ drivers/usb/typec/rt1719.c:132:2: note: Taking true branch if (ret) ^ drivers/usb/typec/rt1719.c:133:3: note: Returning without writing to '*val' return ret; ^ drivers/usb/typec/rt1719.c:666:9: note: Returning from 'rt1719_read16' ret |= rt1719_read16(data, RT1719_REG_STATS, &conn_stat); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/typec/rt1719.c:668:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/usb/typec/rt1719.c:668:2: note: Taking false branch if (ret) ^ drivers/usb/typec/rt1719.c:672:18: note: Assigned value is garbage or undefined data->conn_stat = conn_stat; ^ ~~~~~~~~~ Suppressed 1 warnings (1 with check filters). 2 warnings generated. drivers/net/can/usb/etas_es58x/es58x_core.c:1167: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:1167:23: note: Value stored to 'dev' during its initialization is never read const struct device *dev = es58x_dev->dev; ^~~ ~~~~~~~~~~~~~~ >> drivers/net/can/usb/etas_es58x/es58x_core.c:2214:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] return ret; ^ ~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:2198:14: note: 'ret' declared without an initial value int ch_idx, ret; ^~~ drivers/net/can/usb/etas_es58x/es58x_core.c:2201:2: note: Taking false branch if (IS_ERR(es58x_dev)) ^ drivers/net/can/usb/etas_es58x/es58x_core.c:2204:19: note: Assuming 'ch_idx' is >= field 'num_can_ch' for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/can/usb/etas_es58x/es58x_core.c:2204:2: note: Loop condition is false. Execution continues on line 2212 for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:2214:2: note: Undefined or garbage value returned to caller return ret; ^ ~~~ 1 warning generated. drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:714:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(cmd->map_ch_req.name, name); ^~~~~~ drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:714:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(cmd->map_ch_req.name, name); ^~~~~~ 3 warnings generated. drivers/mtd/ubi/build.c:647:30: warning: Division by zero [clang-analyzer-core.DivideZero] ubi_assert(ubi->min_io_size % ubi->hdrs_min_io_size == 0); ^ drivers/mtd/ubi/debug.h:18:17: note: expanded from macro 'ubi_assert' if (unlikely(!(expr))) { \ ^~~~ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ drivers/mtd/ubi/build.c:594:2: note: Taking false branch dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb)); ^ drivers/mtd/ubi/debug.h:33:27: note: expanded from macro 'dbg_gen' #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__) ^ drivers/mtd/ubi/debug.h:29:2: note: expanded from macro 'ubi_dbg_msg' pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \ ^ include/linux/printk.h:581:2: note: expanded from macro 'pr_debug' dynamic_pr_debug(fmt, ##__VA_ARGS__) ^ note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:357:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:345:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:337:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/mtd/ubi/build.c:594:2: note: Loop condition is false. Exiting loop dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb)); ^ drivers/mtd/ubi/debug.h:33:27: note: expanded from macro 'dbg_gen' #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__) ^ drivers/mtd/ubi/debug.h:29:2: note: expanded from macro 'ubi_dbg_msg' pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \ ^ include/linux/printk.h:581:2: note: expanded from macro 'pr_debug' dynamic_pr_debug(fmt, ##__VA_ARGS__) ^ note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:357:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:345:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:329:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/mtd/ubi/build.c:594:2: note: Taking false branch dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb)); ^ drivers/mtd/ubi/debug.h:33:27: note: expanded from macro 'dbg_gen' #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__) ^ drivers/mtd/ubi/debug.h:29:2: note: expanded from macro 'ubi_dbg_msg' pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \ ^ include/linux/printk.h:581:2: note: expanded from macro 'pr_debug' dynamic_pr_debug(fmt, ##__VA_ARGS__) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/dynamic_debug.h:249:2: note: expanded from macro '_dynamic_func_call' _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:247:2: note: expanded from macro '_dynamic_func_call_cls' __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:222:2: note: expanded from macro '__dynamic_func_call_cls' if (DYNAMIC_DEBUG_BRANCH(id)) \ ^ vim +2214 drivers/net/can/usb/etas_es58x/es58x_core.c 8537257874e949 Vincent Mailhol 2021-04-10 2185 8537257874e949 Vincent Mailhol 2021-04-10 2186 /** 8537257874e949 Vincent Mailhol 2021-04-10 2187 * es58x_probe() - Initialize the USB device. 8537257874e949 Vincent Mailhol 2021-04-10 2188 * @intf: USB interface. 8537257874e949 Vincent Mailhol 2021-04-10 2189 * @id: USB device ID. 8537257874e949 Vincent Mailhol 2021-04-10 2190 * 8537257874e949 Vincent Mailhol 2021-04-10 2191 * Return: zero on success, -ENODEV if the interface is not supported 8537257874e949 Vincent Mailhol 2021-04-10 2192 * or errno when any other error occurs. 8537257874e949 Vincent Mailhol 2021-04-10 2193 */ 8537257874e949 Vincent Mailhol 2021-04-10 2194 static int es58x_probe(struct usb_interface *intf, 8537257874e949 Vincent Mailhol 2021-04-10 2195 const struct usb_device_id *id) 8537257874e949 Vincent Mailhol 2021-04-10 2196 { 8537257874e949 Vincent Mailhol 2021-04-10 2197 struct es58x_device *es58x_dev; 8537257874e949 Vincent Mailhol 2021-04-10 2198 int ch_idx, ret; 8537257874e949 Vincent Mailhol 2021-04-10 2199 45cb13963df304 Vincent Mailhol 2021-06-29 2200 es58x_dev = es58x_init_es58x_dev(intf, id->driver_info); 45cb13963df304 Vincent Mailhol 2021-06-29 2201 if (IS_ERR(es58x_dev)) 45cb13963df304 Vincent Mailhol 2021-06-29 2202 return PTR_ERR(es58x_dev); 8537257874e949 Vincent Mailhol 2021-04-10 2203 8537257874e949 Vincent Mailhol 2021-04-10 2204 for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) { 8537257874e949 Vincent Mailhol 2021-04-10 2205 ret = es58x_init_netdev(es58x_dev, ch_idx); 004653f0abf202 Vincent Mailhol 2021-06-29 2206 if (ret) { 004653f0abf202 Vincent Mailhol 2021-06-29 2207 es58x_free_netdevs(es58x_dev); 8537257874e949 Vincent Mailhol 2021-04-10 2208 return ret; 004653f0abf202 Vincent Mailhol 2021-06-29 2209 } 8537257874e949 Vincent Mailhol 2021-04-10 2210 } 8537257874e949 Vincent Mailhol 2021-04-10 2211 3d1425615e7b18 Vincent Mailhol 2022-11-13 2212 es58x_create_file(es58x_dev->dev); 3d1425615e7b18 Vincent Mailhol 2022-11-13 2213 8537257874e949 Vincent Mailhol 2021-04-10 @2214 return ret; 8537257874e949 Vincent Mailhol 2021-04-10 2215 } 8537257874e949 Vincent Mailhol 2021-04-10 2216 -- 0-DAY CI Kernel Test Service https://01.org/lkp