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: 892a4f6a75
("linux-user: Add partial support for MADV_DONTNEED")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
734a659ad2
commit
f71fa4e3bb
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user