[tglx-devel:x86/fpu 42/78] arch/x86/kernel/fpu/core.c:372:11: warning: variable 'fpdst' is uninitialized when used here

From: kernel test robot
Date: Mon Oct 11 2021 - 17:46:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu
head: cdb8206630ccd0c990e4af058d271f034dfd47de
commit: ec2658e1e6a67104db59576b35507b3cc4567dcb [42/78] x86/fpu: Use fpstate::size
config: i386-randconfig-r034-20211011 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7ae8f392a1610992c9a925c867fd7238c70d3ce0)
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=ec2658e1e6a67104db59576b35507b3cc4567dcb
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 ec2658e1e6a67104db59576b35507b3cc4567dcb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

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/core.c:372:11: warning: variable 'fpdst' is uninitialized when used here [-Wuninitialized]
memcpy(&fpdst->regs, &fpsrc->regs, fpdst->size);
^~~~~
arch/x86/kernel/fpu/core.c:353:23: note: initialize the variable 'fpdst' to silence this warning
struct fpstate *fpdst, *fpsrc = current->thread.fpu.fpstate;
^
= NULL
1 warning generated.


vim +/fpdst +372 arch/x86/kernel/fpu/core.c

349
350 /* Clone current's FPU state on fork */
351 int fpu_clone(struct task_struct *dst_tsk)
352 {
353 struct fpstate *fpdst, *fpsrc = current->thread.fpu.fpstate;
354 struct fpu *src_fpu = &current->thread.fpu;
355 struct fpu *dst_fpu = &dst_tsk->thread.fpu;
356
357 /* The new task's FPU state cannot be valid in the hardware. */
358 dst_fpu->last_cpu = -1;
359
360 fpstate_reset(dst_fpu);
361
362 if (!cpu_feature_enabled(X86_FEATURE_FPU))
363 return 0;
364
365 /*
366 * If the FPU registers are not owned by current just memcpy() the
367 * state. Otherwise save the FPU registers directly into the
368 * child's FPU context, without any memory-to-memory copying.
369 */
370 fpregs_lock();
371 if (test_thread_flag(TIF_NEED_FPU_LOAD))
> 372 memcpy(&fpdst->regs, &fpsrc->regs, fpdst->size);
373 else
374 save_fpregs_to_fpstate(dst_fpu);
375 fpregs_unlock();
376
377 set_tsk_thread_flag(dst_tsk, TIF_NEED_FPU_LOAD);
378
379 trace_x86_fpu_copy_src(src_fpu);
380 trace_x86_fpu_copy_dst(dst_fpu);
381
382 return 0;
383 }
384

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

Attachment: .config.gz
Description: application/gzip