[intel-tdx:kvm-upstream-workaround 449/453] arch/x86/kernel/fpu/xstate.c:718:14: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'unsigned int'

From: kernel test robot
Date: Thu Jun 09 2022 - 08:54:44 EST


tree: https://github.com/intel/tdx.git kvm-upstream-workaround
head: 64f3ddf316eab9398414b94e62a01d185e6e94c8
commit: c00f6297349a8d81049eefe338ee079179787e28 [449/453] X86: FPU: Fix unexpected #PF while executing XRSTORS
config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20220609/202206092038.sxicJCDm-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/c00f6297349a8d81049eefe338ee079179787e28
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream-workaround
git checkout c00f6297349a8d81049eefe338ee079179787e28
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/fpu/

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

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/compat.h:10,
from arch/x86/kernel/fpu/xstate.c:8:
arch/x86/kernel/fpu/xstate.c: In function 'init_xstate_size':
>> arch/x86/kernel/fpu/xstate.c:718:14: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'unsigned int' [-Wformat=]
718 | "Too small init_fpstate size:%ld expected:%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
719 | sizeof(init_fpstate_full), kernel_size);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| unsigned int
include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:132:17: note: in expansion of macro 'printk'
132 | printk(fmt, ##__VA_ARGS__); \
| ^~~~~~
include/asm-generic/bug.h:175:9: note: in expansion of macro 'no_printk'
175 | no_printk(format); \
| ^~~~~~~~~
arch/x86/kernel/fpu/xstate.c:717:9: note: in expansion of macro 'WARN'
717 | WARN(kernel_size > sizeof(init_fpstate_full),
| ^~~~
arch/x86/kernel/fpu/xstate.c:718:45: note: format string is defined here
718 | "Too small init_fpstate size:%ld expected:%d\n",
| ~~^
| |
| long int
| %d


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

685
686 static int __init init_xstate_size(void)
687 {
688 /* Recompute the context size for enabled features: */
689 unsigned int user_size, kernel_size, kernel_default_size;
690 bool compacted = cpu_feature_enabled(X86_FEATURE_XSAVES);
691
692 /* Uncompacted user space size */
693 user_size = get_xsave_size_user();
694
695 /*
696 * XSAVES kernel size includes supervisor states and
697 * uses compacted format when available.
698 *
699 * XSAVE does not support supervisor states so
700 * kernel and user size is identical.
701 */
702 if (compacted)
703 kernel_size = get_xsaves_size_no_independent();
704 else
705 kernel_size = user_size;
706
707 kernel_default_size =
708 xstate_calculate_size(fpu_kernel_cfg.default_features, compacted);
709
710 /* Ensure we have the space to store all default enabled features. */
711 if (!is_supported_xstate_size(kernel_default_size))
712 return -EINVAL;
713
714 if (!paranoid_xstate_size_valid(kernel_size))
715 return -EINVAL;
716
717 WARN(kernel_size > sizeof(init_fpstate_full),
> 718 "Too small init_fpstate size:%ld expected:%d\n",
719 sizeof(init_fpstate_full), kernel_size);
720
721 fpu_kernel_cfg.max_size = kernel_size;
722 fpu_user_cfg.max_size = user_size;
723
724 fpu_kernel_cfg.default_size = kernel_default_size;
725 fpu_user_cfg.default_size =
726 xstate_calculate_size(fpu_user_cfg.default_features, false);
727
728 return 0;
729 }
730

--
0-DAY CI Kernel Test Service
https://01.org/lkp