CC: [email protected] CC: [email protected] CC: [email protected] TO: Jeremy Kerr <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 83e396641110663d3c7bb25b9bc0c6a750359ecf commit: 99ce45d5e7dbde399997a630f45ac9f654fa4bcc mctp: Implement extended addressing date: 4 months ago :::::: branch date: 23 hours ago :::::: commit date: 4 months ago config: mips-randconfig-c004-20220211 (https://download.01.org/0day-ci/archive/20220213/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f6685f774697c85d6a352dcea013f46a99f9fe31) 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 mips cross compiling tool for clang build # apt-get install binutils-mips-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=99ce45d5e7dbde399997a630f45ac9f654fa4bcc git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 99ce45d5e7dbde399997a630f45ac9f654fa4bcc # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 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 >>) ^ include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/net/phy/mscc/mscc_ptp.c:1057:6: note: Calling 'copy_from_user' if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:191:2: note: Taking true branch if (likely(check_copy_size(to, n, false))) ^ include/linux/uaccess.h:192:7: note: Calling '_copy_from_user' n = _copy_from_user(to, from, n); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:157:7: note: Calling 'should_fail_usercopy' if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^~~~~~~~~~~~~~~~~~~~~~ include/linux/fault-inject-usercopy.h:18:49: note: Returning zero, which participates in a condition later static inline bool should_fail_usercopy(void) { return false; } ^~~~~~~~~~~~ include/linux/uaccess.h:157:7: note: Returning from 'should_fail_usercopy' if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:157:6: note: Left side of '&&' is true if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^ include/linux/uaccess.h:157:2: note: Taking true branch if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^ include/linux/uaccess.h:159:9: note: Calling 'raw_copy_from_user' res = raw_copy_from_user(to, from, n); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/include/asm/uaccess.h:455:2: note: Returning without writing to 'to->flags' return __cu_len_r; ^ include/linux/uaccess.h:159:9: note: Returning from 'raw_copy_from_user' res = raw_copy_from_user(to, from, n); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:161:6: note: Assuming 'res' is 0, which participates in a condition later if (unlikely(res)) ^ include/linux/compiler.h:48:24: note: expanded from macro 'unlikely' # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:32: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^~~~ include/linux/uaccess.h:161:2: note: Taking false branch if (unlikely(res)) ^ include/linux/uaccess.h:163:2: note: Returning without writing to 'to->flags' return res; ^ include/linux/uaccess.h:163:2: note: Returning zero (loaded from 'res'), which participates in a condition later return res; ^~~~~~~~~~ include/linux/uaccess.h:192:7: note: Returning from '_copy_from_user' n = _copy_from_user(to, from, n); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:193:2: note: Returning without writing to 'to->flags' return n; ^ include/linux/uaccess.h:193:2: note: Returning zero (loaded from 'n'), which participates in a condition later return n; ^~~~~~~~ drivers/net/phy/mscc/mscc_ptp.c:1057:6: note: Returning from 'copy_from_user' if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/phy/mscc/mscc_ptp.c:1057:2: note: Taking false branch if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) ^ drivers/net/phy/mscc/mscc_ptp.c:1060:6: note: Branch condition evaluates to a garbage value if (cfg.flags) ^~~~~~~~~ drivers/net/phy/mscc/mscc_ptp.c:1449:2: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores] val = vsc85xx_ts_read_csr(phydev, PROCESSOR, MSCC_PHY_PTP_VERSION_CODE); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/phy/mscc/mscc_ptp.c:1449:2: note: Value stored to 'val' is never read val = vsc85xx_ts_read_csr(phydev, PROCESSOR, MSCC_PHY_PTP_VERSION_CODE); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. 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. 4 warnings generated. >> net/mctp/af_mctp.c:243:17: warning: Assigned value is garbage or undefined >> [clang-analyzer-core.uninitialized.Assign] msk->addr_ext = val; ^ ~~~ net/mctp/af_mctp.c:232:26: note: Left side of '&&' is false struct mctp_sock *msk = container_of(sock->sk, struct mctp_sock, sk); ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ net/mctp/af_mctp.c:232:26: note: Taking false branch struct mctp_sock *msk = container_of(sock->sk, struct mctp_sock, sk); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ net/mctp/af_mctp.c:232:26: note: Loop condition is false. Exiting loop struct mctp_sock *msk = container_of(sock->sk, struct mctp_sock, sk); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert' do { \ ^ net/mctp/af_mctp.c:233:2: note: 'val' declared without an initial value int val; ^~~~~~~ net/mctp/af_mctp.c:235:6: note: Assuming 'level' is equal to SOL_MCTP if (level != SOL_MCTP) ^~~~~~~~~~~~~~~~~ net/mctp/af_mctp.c:235:2: note: Taking false branch if (level != SOL_MCTP) ^ net/mctp/af_mctp.c:238:6: note: Assuming 'optname' is equal to MCTP_OPT_ADDR_EXT if (optname == MCTP_OPT_ADDR_EXT) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/mctp/af_mctp.c:238:2: note: Taking true branch if (optname == MCTP_OPT_ADDR_EXT) { ^ net/mctp/af_mctp.c:239:7: note: Assuming the condition is false if (optlen != sizeof(int)) ^~~~~~~~~~~~~~~~~~~~~ net/mctp/af_mctp.c:239:3: note: Taking false branch if (optlen != sizeof(int)) ^ net/mctp/af_mctp.c:241:7: note: Calling 'copy_from_sockptr' if (copy_from_sockptr(&val, optval, sizeof(int))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/sockptr.h:55:9: note: Calling 'copy_from_sockptr_offset' return copy_from_sockptr_offset(dst, src, 0, size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/sockptr.h:47:6: note: Assuming the condition is true if (!sockptr_is_kernel(src)) ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/sockptr.h:47:2: note: Taking true branch if (!sockptr_is_kernel(src)) ^ include/linux/sockptr.h:48:10: note: Calling 'copy_from_user' return copy_from_user(dst, src.user + offset, size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:191:2: note: Taking true branch if (likely(check_copy_size(to, n, false))) ^ include/linux/uaccess.h:192:7: note: Calling '_copy_from_user' n = _copy_from_user(to, from, n); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:157:7: note: Calling 'should_fail_usercopy' if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^~~~~~~~~~~~~~~~~~~~~~ include/linux/fault-inject-usercopy.h:18:49: note: Returning zero, which participates in a condition later static inline bool should_fail_usercopy(void) { return false; } ^~~~~~~~~~~~ include/linux/uaccess.h:157:7: note: Returning from 'should_fail_usercopy' if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^~~~~~~~~~~~~~~~~~~~~~ include/linux/uaccess.h:157:6: note: Left side of '&&' is true if (!should_fail_usercopy() && likely(access_ok(from, n))) { ^ include/linux/uaccess.h:157:2: note: Taking true branch if (!should_fail_usercopy() && likely(access_ok(from, n))) { vim +243 net/mctp/af_mctp.c 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 228 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 229 static int mctp_setsockopt(struct socket *sock, int level, int optname, 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 230 sockptr_t optval, unsigned int optlen) 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 231 { 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 232 struct mctp_sock *msk = container_of(sock->sk, struct mctp_sock, sk); 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 233 int val; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 234 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 235 if (level != SOL_MCTP) 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 236 return -EINVAL; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 237 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 238 if (optname == MCTP_OPT_ADDR_EXT) { 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 239 if (optlen != sizeof(int)) 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 240 return -EINVAL; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 241 if (copy_from_sockptr(&val, optval, sizeof(int))) 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 242 return -EFAULT; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 @243 msk->addr_ext = val; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 244 return 0; 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 245 } 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 246 99ce45d5e7dbde3 Jeremy Kerr 2021-10-26 247 return -ENOPROTOOPT; 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 248 } 8f601a1e4f8c84f Jeremy Kerr 2021-07-29 249 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
