RFR: 8349554: [UBSAN] os::attempt_reserve_memory_between reported applying non-zero offset to non-null pointer produced null pointer
SendaoYan
syan at openjdk.org
Fri Feb 7 15:06:09 UTC 2025
On Fri, 7 Feb 2025 08:50:22 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> But even that compares an address with a range, which is also unfortunate (IMHO). So, I think it would be nicer to extract the max range and use that in the comparison:
>
> ```
> uintptr_t max_range = hi_end - nullptr;
> if (max_range <= bytes) {
> ```
The expr `uintptr_t max_range = hi_end - nullptr;` will case gcc/ckang report compiler error: "invalid operands to binary expression ('char *const' and 'std::nullptr_t')"
So should change like:
- if ((uintptr_t)hi_end < bytes) {
+ if ((uintptr_t)hi_end <= bytes) {
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23508#issuecomment-2643190382
More information about the hotspot-runtime-dev
mailing list