Skip to content
Snippets Groups Projects
Commit f71fa4e3 authored by Ilya Leoshkevich's avatar Ilya Leoshkevich Committed by Laurent Vivier
Browse files

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: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
Message-Id: <20220725134100.128035-1-iii@linux.ibm.com>
Fixes: 892a4f6a ("linux-user: Add partial support for MADV_DONTNEED")
Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
parent 734a659a
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment