[tglx-devel:x86/fpu 74/82] arch/x86/kernel/fpu/xstate.c:1314:14: warning: comparison between pointer and integer ('struct fpstate *' and 'u64' (aka 'unsigned long long'))

From: kernel test robot
Date: Fri Oct 15 2021 - 03:33:08 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu
head: fbeb78415a1b32f890fa49e4355faa02bb0c0602
commit: 14b0c6c4efcd1654d291d501cca977f3476a5c10 [74/82] x86/fpu: Add sanity checks for XFD
config: x86_64-randconfig-a012-20211014 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project acb3b187c4c88650a6a717a1bcb234d27d0d7f54)
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=14b0c6c4efcd1654d291d501cca977f3476a5c10
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
git checkout 14b0c6c4efcd1654d291d501cca977f3476a5c10
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/fpu/xstate.c:1314:14: warning: comparison between pointer and integer ('struct fpstate *' and 'u64' (aka 'unsigned long long')) [-Wpointer-integer-compare]
if (fpstate == current->thread.fpu.fpstate->xfd)
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


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

1304
1305 #ifdef CONFIG_X86_DEBUG_FPU
1306 static inline bool xfd_valid(struct fpstate *fpstate, u64 mask, bool rstor)
1307 {
1308 u64 xfd = __this_cpu_read(xfd_state);
1309
1310 if (fpstate->xfd == xfd)
1311 return true;
1312
1313 /* For current's fpstate the XFD state must be correct. */
> 1314 if (fpstate == current->thread.fpu.fpstate->xfd)
1315 return false;
1316
1317 /*
1318 * XRSTOR(S) from init_fpstate are always correct as it will just
1319 * bring all components into init state and not read from the
1320 * buffer. XSAVE(S) raises #PF after init.
1321 */
1322 if (fpstate == &init_fpstate)
1323 return rstor;
1324
1325 /*
1326 * XSAVE(S): clone(), fpu_swap_kvm_fpu()
1327 * XRSTORS(S): fpu_swap_kvm_fpu()
1328 */
1329
1330 /* Remove XFD disabled states from the mask. */
1331 mask &= ~xfd;
1332 /* Remove features which are valid in fpstate. */
1333 mask &= ~fpstate->xfeatures;
1334
1335 /*
1336 * Mask should be zero now which means no loads/stores
1337 * past the end of the register state buffer.
1338 */
1339 return !mask;
1340 }
1341

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

Attachment: .config.gz
Description: application/gzip