x86/pv: fix clang build without CONFIG_PV32
authorRoger Pau Monné <roger.pau@citrix.com>
Fri, 23 Apr 2021 13:58:37 +0000 (15:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Apr 2021 13:58:37 +0000 (15:58 +0200)
commitfc5d0c98076b4c84fa978259eae0f521e95962c7
tree939fac1ce3c03f344f19ba8368d5d7222a310b51
parentfae4f071e1e14b005c8c4d79eda9ec7778cb21d8
x86/pv: fix clang build without CONFIG_PV32

Clang reports the following build error without CONFIG_PV32:

hypercall.c:253:10: error: variable 'op' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
    if ( !is_pv_32bit_vcpu(curr) )
         ^~~~~~~~~~~~~~~~~~~~~~~
hypercall.c:282:21: note: uninitialized use occurs here
    return unlikely(op == __HYPERVISOR_iret)
                    ^~
/root/src/xen/xen/include/xen/compiler.h:21:43: note: expanded from macro 'unlikely'
#define unlikely(x)   __builtin_expect(!!(x),0)
                                          ^
hypercall.c:253:5: note: remove the 'if' if its condition is always true
    if ( !is_pv_32bit_vcpu(curr) )
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hypercall.c:251:21: note: initialize the variable 'op' to silence this warning
    unsigned long op;
                    ^
                     = 0

Rearrange the code in arch_do_multicall_call so that the if guards the
32bit branch and when CONFIG_PV32 is not set there's no conditional at
all.

Fixes: 527922008bc ('x86: slim down hypercall handling when !PV32')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/pv/hypercall.c