|
From: | Paolo Bonzini |
Subject: | Re: [PATCH] qtest: fix 'expression is always false' build failure in qtest_has_accel() |
Date: | Wed, 27 Oct 2021 17:59:44 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 |
On 27/10/21 09:45, Igor Mammedov wrote:
If KVM is disabled or not present, qtest library build may fail with: libqtest.c: In function 'qtest_has_accel': comparison of unsigned expression < 0 is always false [-Werror=type-limits] for (i = 0; i < ARRAY_SIZE(targets); i++) { due to empty 'targets' array. Fix it by compiling KVM related part only if CONFIG_KVM_TARGETS is set.
Another possibility is to add a trailing NULL to the array and change the loop to "for (i = 0; targets[i]; i++)".
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |