Clang 8.0 throws an error in the get_top_bit function:
guest_walk.c:328:15: error: variable 'topbit' is used uninitialized
whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
else if ( is_64bit_domain(d) )
^~~~~~~~~~~~~~~~~~
This is happening because clang thinks that is_32bit_domain(d) is not
the exact inverse of is_64bit_domain(d). So it expects a else case to
handle the case where the latter call is false.
In other part of the code, dealing with difference between 32-bit and
64-bit domain, we usually use if ( is_XXbit_domain ) ... else ...
So use the same pattern here.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
*/
if ( is_32bit_domain(d) )
topbit = 31;
- else if ( is_64bit_domain(d) )
+ else
{
if ( ((gva & BIT_ULL(55)) && (tcr & TCR_EL1_TBI1)) ||
(!(gva & BIT_ULL(55)) && (tcr & TCR_EL1_TBI0)) )