aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2022-07-25 15:41:00 +0200
committerLaurent Vivier <laurent@vivier.eu>2022-07-29 15:08:24 +0200
commitf71fa4e3bb22f534ee668e7f4bdf64e59c193afd (patch)
tree31973743c9a14adf663f1f211d0744c9f97be3bc /linux-user
parent734a659ad264ac080457167e845ffabbaaa66d0e (diff)
linux-user: Do not treat madvise()'s advice as a bitmask
Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches e.g. MADV_MERGEABLE. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220725134100.128035-1-iii@linux.ibm.com> Fixes: 892a4f6a750a ("linux-user: Add partial support for MADV_DONTNEED") Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/mmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 4e7a6be6ee..edceaca4a8 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -891,7 +891,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
* anonymous mappings. In this case passthrough is safe, so do it.
*/
mmap_lock();
- if ((advice & MADV_DONTNEED) &&
+ if (advice == MADV_DONTNEED &&
can_passthrough_madv_dontneed(start, end)) {
ret = get_errno(madvise(g2h_untagged(start), len, MADV_DONTNEED));
}