[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] linux-user: limit check to HOST_LONG_BITS == 32
From: |
Alex Bennée |
Subject: |
[PATCH] linux-user: limit check to HOST_LONG_BITS == 32 |
Date: |
Thu, 21 May 2020 11:21:30 +0100 |
Newer clangs rightly spot that you can never exceed the full address
space of 64 bit hosts with:
linux-user/elfload.c:2076:41: error: result of comparison 'unsigned
long' > 18446744073709551615 is always false
[-Werror,-Wtautological-type-limit-compare]
4685 if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
4686 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
4687 1 error generated.
So lets limit the check to 32 bit hosts only.
Fixes: ee94743034bf
Reported-by: Thomas Huth <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
---
linux-user/elfload.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 01a9323a637..797fbf2337a 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2072,6 +2072,7 @@ static void pgb_have_guest_base(const char *image_name,
abi_ulong guest_loaddr,
image_name, (uint64_t)guest_hiaddr, reserved_va);
exit(EXIT_FAILURE);
}
+#if HOST_LONG_BITS == 32
} else {
if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
error_report("%s: requires more virtual address space "
@@ -2079,6 +2080,7 @@ static void pgb_have_guest_base(const char *image_name,
abi_ulong guest_loaddr,
image_name, (uint64_t)guest_hiaddr - guest_base);
exit(EXIT_FAILURE);
}
+#endif
}
/*
--
2.20.1
- [PATCH] linux-user: limit check to HOST_LONG_BITS == 32,
Alex Bennée <=