From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02E3017C8 for ; Thu, 14 Apr 2022 12:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649937623; x=1681473623; h=date:from:to:cc:subject:message-id:mime-version; bh=7Xxdd7CTU4JSmAB8vadoOE5nFDUv6g9RmCSrNgR6vQE=; b=HQRVF6htbS7IRb9BmPt7XATunXtCODme5DruhVg53wg1hadON/3Ao7/h fJQ8xa9jgncL5faVeNhaAGNEcUCCwseFyH2A2urIHVMe6tgye9qE1JXFt nBBpK/cFgmfBdinqfwAL3tBSuVo+LY4Th7j0JXE1sx6d/lqLroKCkfP9C jJEdyTUFk6erD3tkLBfV0VnNdPMVvR2IwRRuwr91RKr74i5CkLhMMWb2o kLLin3oes+0ekmnV1SEdeDvwryr2bqd1BXipcMXXe+w//oZ8c4gLSrROP WAzNpz1gKbNCi7m6AV97l4HQj9/++drzZ0vqDB9znoQuAZD/qAsTLHeAB Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10316"; a="260509138" X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="260509138" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 05:00:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,259,1643702400"; d="scan'208";a="661351212" Received: from lkp-server01.sh.intel.com (HELO 3abc53900bec) ([10.239.97.150]) by orsmga004.jf.intel.com with ESMTP; 14 Apr 2022 05:00:20 -0700 Received: from kbuild by 3abc53900bec with local (Exim 4.95) (envelope-from ) id 1ney95-0000w1-Cu; Thu, 14 Apr 2022 12:00:19 +0000 Date: Thu, 14 Apr 2022 19:59:56 +0800 From: kernel test robot To: Chuck Lever Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: [cel:topic-rpc-with-tls-upcall 5/21] net/tls/af_tlsh.c:635:6: warning: variable 'outlen' is used uninitialized whenever 'if' condition is true Message-ID: <202204141943.5IfaboCX-lkp@intel.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) tree: git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux topic-rpc-with-tls-upcall head: 77d1002f5a5209bebd901cf895b52730199c0ba4 commit: 10e1271d05810b1163c4e79bc9597c0177e2aaeb [5/21] net/tls: Add support for PF_TLSH (a TLS handshake listener) config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220414/202204141943.5IfaboCX-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6b7e6ea489f6dd45a9b0da9ac20871560917b9b0) 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://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/commit/?id=10e1271d05810b1163c4e79bc9597c0177e2aaeb git remote add cel git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux git fetch --no-tags cel topic-rpc-with-tls-upcall git checkout 10e1271d05810b1163c4e79bc9597c0177e2aaeb # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/tls/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> net/tls/af_tlsh.c:635:6: warning: variable 'outlen' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (val) { ^~~ net/tls/af_tlsh.c:647:15: note: uninitialized use occurs here if (put_user(outlen, optlen)) ^~~~~~ arch/x86/include/asm/uaccess.h:225:70: note: expanded from macro 'put_user' #define put_user(x, ptr) ({ might_fault(); do_put_user_call(put_user,x,ptr); }) ^ arch/x86/include/asm/uaccess.h:197:14: note: expanded from macro 'do_put_user_call' __val_pu = (x); \ ^ net/tls/af_tlsh.c:635:2: note: remove the 'if' if its condition is always false if (val) { ^~~~~~~~~~ net/tls/af_tlsh.c:611:12: note: initialize the variable 'outlen' to silence this warning int outlen, len, ret; ^ = 0 1 warning generated. vim +635 net/tls/af_tlsh.c 606 607 static int tlsh_getsockopt_priorities(struct sock *sk, char __user *optval, 608 int __user *optlen) 609 { 610 struct tlsh_sock_info *info; 611 int outlen, len, ret; 612 const char *val; 613 614 if (get_user(len, optlen)) 615 return -EFAULT; 616 if (!optval) 617 return -EINVAL; 618 619 ret = 0; 620 621 sock_hold(sk); 622 write_lock_bh(&sk->sk_callback_lock); 623 624 info = sk->sk_tlsh_priv; 625 if (info) { 626 val = info->tsi_tls_priorities; 627 } else { 628 write_unlock_bh(&sk->sk_callback_lock); 629 ret = -EBUSY; 630 goto out_put; 631 } 632 633 write_unlock_bh(&sk->sk_callback_lock); 634 > 635 if (val) { 636 int outlen = strlen(val); 637 638 if (len < outlen) 639 ret = -EINVAL; 640 else if (copy_to_user(optval, val, outlen)) 641 ret = -EFAULT; 642 } else { 643 outlen = 0; 644 } 645 646 647 if (put_user(outlen, optlen)) 648 ret = -EFAULT; 649 650 out_put: 651 sock_put(sk); 652 return ret; 653 } 654 -- 0-DAY CI Kernel Test Service https://01.org/lkp