From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZS7-0008Gw-UI for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZS5-000405-Ap for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:35 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:35824) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHZS5-0003z2-4l for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:33 -0400 Received: by mail-pg0-x242.google.com with SMTP id f127so7257052pgc.2 for ; Sun, 04 Jun 2017 10:36:33 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Sun, 4 Jun 2017 10:34:58 -0700 Message-Id: <20170604173509.29684-59-rth@twiddle.net> In-Reply-To: <20170604173509.29684-1-rth@twiddle.net> References: <20170604173509.29684-1-rth@twiddle.net> Subject: [Qemu-devel] [PULL 58/69] target/s390x: fix adj_len_to_page List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aurelien@aurel32.net From: Aurelien Jarno adj_len_to_page doesn't return the correct result when the address is already page aligned and the length is bigger than a page. Fix that. Reviewed-by: Richard Henderson Signed-off-by: Aurelien Jarno Message-Id: <20170531220129.27724-20-aurelien@aurel32.net> Signed-off-by: Richard Henderson --- target/s390x/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index aaa347c..6dfa087 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -61,7 +61,7 @@ static inline uint32_t adj_len_to_page(uint32_t len, uint64_t addr) { #ifndef CONFIG_USER_ONLY if ((addr & ~TARGET_PAGE_MASK) + len - 1 >= TARGET_PAGE_SIZE) { - return -addr & ~TARGET_PAGE_MASK; + return -(addr | TARGET_PAGE_MASK); } #endif return len; -- 2.9.4