]> xenbits.xensource.com Git - people/dariof/qemu-xen.git/commitdiff
s390x/tcg: Fix length calculation in probe_write_access()
authorDavid Hildenbrand <david@redhat.com>
Mon, 26 Aug 2019 07:51:07 +0000 (09:51 +0200)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 3 Sep 2019 15:34:18 +0000 (08:34 -0700)
Hm... how did that "-" slip in (-TAGRET_PAGE_SIZE would be correct). This
currently makes us exceed one page in a single probe_write() call,
essentially leaving some memory unchecked.

Fixes: c5a7392cfb96 ("s390x/tcg: Provide probe_write_access helper")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20190826075112.25637-3-david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/s390x/mem_helper.c

index 7819aca15dad7cf4fdb510df983d565657a9725c..4b43440e89e8fc4e7ae1baf85532b404b7abf9de 100644 (file)
@@ -2623,7 +2623,7 @@ void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len,
 #else
     /* test the actual access, not just any access to the page due to LAP */
     while (len) {
-        const uint64_t pagelen = -(addr | -TARGET_PAGE_MASK);
+        const uint64_t pagelen = -(addr | TARGET_PAGE_MASK);
         const uint64_t curlen = MIN(pagelen, len);
 
         probe_write(env, addr, curlen, cpu_mmu_index(env, false), ra);