From 10310cbd6298def2dafd40069e27df2d25e233c5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 6 Mar 2023 02:03:13 +0300 Subject: accel/tcg: Pass last not end to page_reset_target_data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass the address of the last byte to be changed, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-user') diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 1d07ff5..995146f 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -946,7 +946,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) if (can_passthrough_madvise(start, end)) { ret = get_errno(madvise(g2h_untagged(start), len, advice)); if ((advice == MADV_DONTNEED) && (ret == 0)) { - page_reset_target_data(start, start + len); + page_reset_target_data(start, start + len - 1); } } } -- cgit v1.1