gh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)

mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current
check never detects mmap failures, so jitdump initialization proceeds
even when the memory mapping fails.
This commit is contained in:
stratakis 2026-01-28 14:30:17 +01:00 committed by GitHub
parent 08d7bd28fe
commit 8fe8a94a7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -1083,7 +1083,8 @@ static void* perf_map_jit_init(void) {
0 // Offset 0 (first page)
);
if (perf_jit_map_state.mapped_buffer == NULL) {
if (perf_jit_map_state.mapped_buffer == MAP_FAILED) {
perf_jit_map_state.mapped_buffer = NULL;
close(fd);
return NULL; // Memory mapping failed
}