lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 14 Apr 2022 19:59:56 +0800
From:   kernel test robot <lkp@...el.com>
To:     Chuck Lever <chuck.lever@...cle.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.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

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 <lkp@...el.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ