[PATCH] KVM: selftests: Fix GUEST_PRINTF() format warnings in ARM code
Zenghui Yu
yuzenghui at huawei.com
Wed Feb 7 21:00:08 PST 2024
On 2024/2/3 7:46, Sean Christopherson wrote:
> Fix a pile of -Wformat warnings in the KVM ARM selftests code, almost all
> of which are benign "long" versus "long long" issues (selftests are 64-bit
> only, and the guest printf code treats "ll" the same as "l"). The code
> itself isn't problematic, but the warnings make it impossible to build ARM
> selftests with -Werror, which does detect real issues from time to time.
>
> Opportunistically have GUEST_ASSERT_BITMAP_REG() interpret set_expected,
> which is a bool, as an unsigned decimal value, i.e. have it print '0' or
> '1' instead of '0x0' or '0x1'.
>
> Signed-off-by: Sean Christopherson <seanjc at google.com>
Tested-by: Zenghui Yu <yuzenghui at huawei.com>
> diff --git a/tools/testing/selftests/kvm/aarch64/arch_timer.c b/tools/testing/selftests/kvm/aarch64/arch_timer.c
> index 274b8465b42a..d5e8f365aa01 100644
> --- a/tools/testing/selftests/kvm/aarch64/arch_timer.c
> +++ b/tools/testing/selftests/kvm/aarch64/arch_timer.c
> @@ -158,9 +158,9 @@ static void guest_validate_irq(unsigned int intid,
>
> /* Basic 'timer condition met' check */
> __GUEST_ASSERT(xcnt >= cval,
> - "xcnt = 0x%llx, cval = 0x%llx, xcnt_diff_us = 0x%llx",
> + "xcnt = 0x%lx, cval = 0x%lx, xcnt_diff_us = 0x%lx",
> xcnt, cval, xcnt_diff_us);
> - __GUEST_ASSERT(xctl & CTL_ISTATUS, "xcnt = 0x%llx", xcnt);
> + __GUEST_ASSERT(xctl & CTL_ISTATUS, "xcnt = 0x%lx", xcnt);
Unrelated to your patch, but it looks to me that we actually want to
print 'xctl' instead of 'xcnt' in the second __GUEST_ASSERT().
Thanks,
Zenghui
More information about the linux-arm-kernel
mailing list