Skip to content

Commit a11128c

Browse files
Ethan Zhaosean-jc
authored andcommitted
KVM: x86/cpuid: add type suffix to decimal const 48 fix building warning
The default type of a decimal constant is determined by the magnitude of its value. If the value falls within the range of int, its type is int; otherwise, if it falls within the range of unsigned int, its type is unsigned int. This results in the constant 48 being of type int. In the following min call, g_phys_as = min(g_phys_as, 48); This leads to a building warning/error (CONFIG_KVM_WERROR=y) caused by the mismatch between the types of the two arguments to macro min. By adding the suffix U to explicitly declare the type of the constant, this issue is fixed. Signed-off-by: Ethan Zhao <haifeng.zhao@linux.intel.com> Link: https://lore.kernel.org/r/20250127013837.12983-1-haifeng.zhao@linux.intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e9cb610 commit a11128c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
17041704
phys_as = entry->eax & 0xff;
17051705
g_phys_as = phys_as;
17061706
if (kvm_mmu_get_max_tdp_level() < 5)
1707-
g_phys_as = min(g_phys_as, 48);
1707+
g_phys_as = min(g_phys_as, 48U);
17081708
}
17091709

17101710
entry->eax = phys_as | (virt_as << 8) | (g_phys_as << 16);

0 commit comments

Comments
 (0)