arch/x86/xen/enlighten_pvh.c:55:10: warning: comparison of distinct pointer types ('typeof (ret * sizeof(char)) *' (aka 'unsigned long *') and 'typeof (sizeof (op.u.dom0_console)) *' (aka 'unsigned int *'))

From: kernel test robot
Date: Mon Mar 20 2023 - 16:46:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7d31677bb7b1944ac89e9155110dc1b9acbb3895
commit: 934ef33ee75c3846f605f18b65048acd147e3918 x86/PVH: obtain VGA console info in Dom0
date: 6 days ago
config: i386-buildonly-randconfig-r006-20230320 (https://download.01.org/0day-ci/archive/20230321/202303210458.T1bzVRT2-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/torvalds/linux.git/commit/?id=934ef33ee75c3846f605f18b65048acd147e3918
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 934ef33ee75c3846f605f18b65048acd147e3918
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/xen/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303210458.T1bzVRT2-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/x86/xen/enlighten_pvh.c:55:10: warning: comparison of distinct pointer types ('typeof (ret * sizeof(char)) *' (aka 'unsigned long *') and 'typeof (sizeof (op.u.dom0_console)) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
min(ret * sizeof(char),
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:67:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.


vim +55 arch/x86/xen/enlighten_pvh.c

27
28 void __init xen_pvh_init(struct boot_params *boot_params)
29 {
30 u32 msr;
31 u64 pfn;
32
33 xen_pvh = 1;
34 xen_domain_type = XEN_HVM_DOMAIN;
35 xen_start_flags = pvh_start_info.flags;
36
37 msr = cpuid_ebx(xen_cpuid_base() + 2);
38 pfn = __pa(hypercall_page);
39 wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
40
41 if (xen_initial_domain())
42 x86_init.oem.arch_setup = xen_add_preferred_consoles;
43 x86_init.oem.banner = xen_banner;
44
45 xen_efi_init(boot_params);
46
47 if (xen_initial_domain()) {
48 struct xen_platform_op op = {
49 .cmd = XENPF_get_dom0_console,
50 };
51 long ret = HYPERVISOR_platform_op(&op);
52
53 if (ret > 0)
54 xen_init_vga(&op.u.dom0_console,
> 55 min(ret * sizeof(char),
56 sizeof(op.u.dom0_console)),
57 &boot_params->screen_info);
58 }
59 }
60

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests