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]
Message-ID: <202112141631.KodrezTK-lkp@intel.com>
Date:   Tue, 14 Dec 2021 16:05:14 +0800
From:   kernel test robot <lkp@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [tglx-devel:x86/fpu-kvm 1/6] arch/x86/kernel/fpu/xstate.c:1625:6:
 warning: variable 'ret' is used uninitialized whenever 'if' condition is
 false

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu-kvm
head:   e16d6eec3c9e60abfb29d0d77f08411d326142dd
commit: 8a4ae8c80ec211646b5824b7c89d64cf7d286625 [1/6] x86/fpu: Extend fpu_xstate_prctl() with guest permissions
config: x86_64-randconfig-r035-20211213 (https://download.01.org/0day-ci/archive/20211214/202112141631.KodrezTK-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
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/tglx/devel.git/commit/?id=8a4ae8c80ec211646b5824b7c89d64cf7d286625
        git remote add tglx-devel https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git
        git fetch --no-tags tglx-devel x86/fpu-kvm
        git checkout 8a4ae8c80ec211646b5824b7c89d64cf7d286625
        # 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 arch/x86/kernel/fpu/

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 >>):

>> arch/x86/kernel/fpu/xstate.c:1625:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!guest) {
               ^~~~~~
   arch/x86/kernel/fpu/xstate.c:1637:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   arch/x86/kernel/fpu/xstate.c:1625:2: note: remove the 'if' if its condition is always true
           if (!guest) {
           ^~~~~~~~~~~~
   arch/x86/kernel/fpu/xstate.c:1611:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +1625 arch/x86/kernel/fpu/xstate.c

  1597	
  1598	static int __xstate_request_perm(u64 permitted, u64 requested, bool guest)
  1599	{
  1600		/*
  1601		 * This deliberately does not exclude !XSAVES as we still might
  1602		 * decide to optionally context switch XCR0 or talk the silicon
  1603		 * vendors into extending XFD for the pre AMX states, especially
  1604		 * AVX512.
  1605		 */
  1606		bool compacted = cpu_feature_enabled(X86_FEATURE_XSAVES);
  1607		struct fpu *fpu = &current->group_leader->thread.fpu;
  1608		struct fpu_state_perm *perm;
  1609		unsigned int ksize, usize;
  1610		u64 mask;
  1611		int ret;
  1612	
  1613		/* Check whether fully enabled */
  1614		if ((permitted & requested) == requested)
  1615			return 0;
  1616	
  1617		/* Calculate the resulting kernel state size */
  1618		mask = permitted | requested;
  1619		ksize = xstate_calculate_size(mask, compacted);
  1620	
  1621		/* Calculate the resulting user state size */
  1622		mask &= XFEATURE_MASK_USER_SUPPORTED;
  1623		usize = xstate_calculate_size(mask, false);
  1624	
> 1625		if (!guest) {
  1626			ret = validate_sigaltstack(usize);
  1627			if (ret)
  1628				return ret;
  1629		}
  1630	
  1631		perm = guest ? &fpu->guest_perm : &fpu->perm;
  1632		/* Pairs with the READ_ONCE() in xstate_get_group_perm() */
  1633		WRITE_ONCE(perm->__state_perm, requested);
  1634		/* Protected by sighand lock */
  1635		perm->__state_size = ksize;
  1636		perm->__user_state_size = usize;
  1637		return ret;
  1638	}
  1639	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ