:::::: :::::: Manual check reason: "low confidence static check warning: drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:323:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]" ::::::
CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Jiri Pirko <[email protected]> tree: https://github.com/jpirko/linux_mlxsw jiri_devel_lc_dev head: e2de0017d7e8979fd196f786987bbb81a0ed3e9d commit: 76d11dbddaefa6db02028619cf665afb8d70650b [9/10] mlxsw: core_linecards: Expose device PSID over device info :::::: branch date: 20 hours ago :::::: commit date: 20 hours ago config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220604/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b364c76683f8ef241025a9556300778c07b590c2) 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/jpirko/linux_mlxsw/commit/76d11dbddaefa6db02028619cf665afb8d70650b git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw git fetch --no-tags jpirko-mlxsw jiri_devel_lc_dev git checkout 76d11dbddaefa6db02028619cf665afb8d70650b # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:128:7: note: 'err' is 0 if (err) ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:128:3: note: '?' condition is false if (err) ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value' (cond) ? \ ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:128:3: note: Taking false branch if (err) ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:136:7: note: Assuming 'data_valid' is true if (!data_valid) ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:136:3: note: '?' condition is false if (!data_valid) ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:136:8: note: 'data_valid' is true if (!data_valid) ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:136:3: note: '?' condition is false if (!data_valid) ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value' (cond) ? \ ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:136:3: note: Taking false branch if (!data_valid) ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:138:3: note: 1st function call argument is an uninitialized value if (!flash_owner) /* We care only about flashable ones. */ ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ ~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:310:2: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] sprintf(buf, "%d", linecard->hw_revision); ^~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:310:2: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 sprintf(buf, "%d", linecard->hw_revision); ^~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:315:2: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] sprintf(buf, "%d", linecard->ini_version); ^~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:315:2: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 sprintf(buf, "%d", linecard->ini_version); ^~~~~~~ >> drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:323:3: warning: Value >> stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] err = devlink_info_version_fixed_put(req, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:323:3: note: Value stored to 'err' is never read err = devlink_info_version_fixed_put(req, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:327:3: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] sprintf(buf, "%u.%u.%u", info->fw_major, info->fw_minor, ^~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:327:3: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 sprintf(buf, "%u.%u.%u", info->fw_major, info->fw_minor, ^~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:901:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(event->mddq_pl, mddq_pl, sizeof(event->mddq_pl)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:901:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(event->mddq_pl, mddq_pl, sizeof(event->mddq_pl)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:934:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(event->mbct_pl, mbct_pl, sizeof(event->mbct_pl)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:934:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(event->mbct_pl, mbct_pl, sizeof(event->mbct_pl)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1121:8: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] err = snprintf(filename, sizeof(filename), ^~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1121:8: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 err = snprintf(filename, sizeof(filename), ^~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1148:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(types_info->data, firmware->data, types_info->data_size); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1148:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(types_info->data, firmware->data, types_info->data_size); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ Suppressed 224 warnings (223 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 74 warnings generated. Suppressed 74 warnings (74 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. 99 warnings generated. net/ethtool/ioctl.c:201:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(data, netdev_features_strings, ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:201:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(data, netdev_features_strings, ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:204:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(data, rss_hash_func_strings, ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:204:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(data, rss_hash_func_strings, ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:207:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(data, tunable_strings, sizeof(tunable_strings)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:207:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(data, tunable_strings, sizeof(tunable_strings)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) ^~~~~~~~~~~~~~~~ net/ethtool/ioctl.c:209:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(data, phy_tunable_strings, sizeof(phy_tunable_strings)); ^ arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy' #define memcpy(t, f, n) __builtin_memcpy(t, f, n) vim +/err +323 drivers/net/ethernet/mellanox/mlxsw/core_linecards.c de28976d2650d3 Jiri Pirko 2022-04-19 296 61245ead6e2b9f Jiri Pirko 2022-06-02 297 int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard, 61245ead6e2b9f Jiri Pirko 2022-06-02 298 struct devlink_info_req *req, 61245ead6e2b9f Jiri Pirko 2022-06-02 299 struct netlink_ext_ack *extack) 61245ead6e2b9f Jiri Pirko 2022-06-02 300 { 61245ead6e2b9f Jiri Pirko 2022-06-02 301 char buf[32]; 61245ead6e2b9f Jiri Pirko 2022-06-02 302 int err; 61245ead6e2b9f Jiri Pirko 2022-06-02 303 61245ead6e2b9f Jiri Pirko 2022-06-02 304 mutex_lock(&linecard->lock); 61245ead6e2b9f Jiri Pirko 2022-06-02 305 if (WARN_ON(!linecard->provisioned)) { 61245ead6e2b9f Jiri Pirko 2022-06-02 306 err = 0; 61245ead6e2b9f Jiri Pirko 2022-06-02 307 goto unlock; 61245ead6e2b9f Jiri Pirko 2022-06-02 308 } 61245ead6e2b9f Jiri Pirko 2022-06-02 309 61245ead6e2b9f Jiri Pirko 2022-06-02 310 sprintf(buf, "%d", linecard->hw_revision); 61245ead6e2b9f Jiri Pirko 2022-06-02 311 err = devlink_info_version_fixed_put(req, "hw.revision", buf); 61245ead6e2b9f Jiri Pirko 2022-06-02 312 if (err) 61245ead6e2b9f Jiri Pirko 2022-06-02 313 goto unlock; 61245ead6e2b9f Jiri Pirko 2022-06-02 314 61245ead6e2b9f Jiri Pirko 2022-06-02 315 sprintf(buf, "%d", linecard->ini_version); 61245ead6e2b9f Jiri Pirko 2022-06-02 316 err = devlink_info_version_running_put(req, "ini.version", buf); 61245ead6e2b9f Jiri Pirko 2022-06-02 317 if (err) 61245ead6e2b9f Jiri Pirko 2022-06-02 318 goto unlock; 61245ead6e2b9f Jiri Pirko 2022-06-02 319 a07ffbd025d76f Jiri Pirko 2022-04-25 320 if (linecard->ready) { a07ffbd025d76f Jiri Pirko 2022-04-25 321 struct mlxsw_linecard_device_info *info = &linecard->device.info; a07ffbd025d76f Jiri Pirko 2022-04-25 322 76d11dbddaefa6 Jiri Pirko 2022-06-03 @323 err = devlink_info_version_fixed_put(req, 76d11dbddaefa6 Jiri Pirko 2022-06-03 324 DEVLINK_INFO_VERSION_GENERIC_FW_PSID, 76d11dbddaefa6 Jiri Pirko 2022-06-03 325 info->psid); 76d11dbddaefa6 Jiri Pirko 2022-06-03 326 a07ffbd025d76f Jiri Pirko 2022-04-25 327 sprintf(buf, "%u.%u.%u", info->fw_major, info->fw_minor, a07ffbd025d76f Jiri Pirko 2022-04-25 328 info->fw_sub_minor); a07ffbd025d76f Jiri Pirko 2022-04-25 329 err = devlink_info_version_running_put(req, a07ffbd025d76f Jiri Pirko 2022-04-25 330 DEVLINK_INFO_VERSION_GENERIC_FW, a07ffbd025d76f Jiri Pirko 2022-04-25 331 buf); a07ffbd025d76f Jiri Pirko 2022-04-25 332 if (err) a07ffbd025d76f Jiri Pirko 2022-04-25 333 goto unlock; a07ffbd025d76f Jiri Pirko 2022-04-25 334 } a07ffbd025d76f Jiri Pirko 2022-04-25 335 61245ead6e2b9f Jiri Pirko 2022-06-02 336 unlock: 61245ead6e2b9f Jiri Pirko 2022-06-02 337 mutex_unlock(&linecard->lock); 61245ead6e2b9f Jiri Pirko 2022-06-02 338 return err; 61245ead6e2b9f Jiri Pirko 2022-06-02 339 } 61245ead6e2b9f Jiri Pirko 2022-06-02 340 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
