In this test, at->ptep is tested in one argument to ac_test_check and dereferenced in another. The compiler notices that and observes that at->ptep cannot be NULL. The test is indeed broken and has been broken for 9+ years: the ac_test_check should not be performed at all if there is no PTE. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- x86/access.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x86/access.c b/x86/access.c index f0d1879..4ec0b0a 100644 --- a/x86/access.c +++ b/x86/access.c @@ -704,8 +704,9 @@ static int ac_test_do_access(ac_test_t *at) "unexpected access"); ac_test_check(at, &success, fault && e != at->expected_error, "error code %x expected %x", e, at->expected_error); - ac_test_check(at, &success, at->ptep && *at->ptep != at->expected_pte, - "pte %x expected %x", *at->ptep, at->expected_pte); + if (at->ptep) + ac_test_check(at, &success, *at->ptep != at->expected_pte, + "pte %x expected %x", *at->ptep, at->expected_pte); ac_test_check(at, &success, !pt_match(*at->pdep, at->expected_pde, at->ignore_pde), "pde %x expected %x", *at->pdep, at->expected_pde); -- 2.21.0