Skip to content

correct mmap error check#4560

Merged
terrelln merged 1 commit intofacebook:devfrom
richardsonnick:fix-mmap-null-check
Feb 27, 2026
Merged

correct mmap error check#4560
terrelln merged 1 commit intofacebook:devfrom
richardsonnick:fix-mmap-null-check

Conversation

@richardsonnick
Copy link
Copy Markdown
Contributor

According to the mmap docs MAP_FAILED is returned upon error:

On success, mmap() returns a pointer to the mapped area. On
error, the value MAP_FAILED (that is, (void *) -1) is returned,
and errno is set to indicate the error.

Update mmap error validation to check for MAP_FAILED instead of NULL. POSIX specifies that mmap returns MAP_FAILED (-1) on failure.

Reported-by: Clang 21 Static Analyzer

Update mmap error validation to check for MAP_FAILED instead of NULL.
POSIX specifies that mmap returns MAP_FAILED (-1) on failure.
@meta-cla meta-cla Bot added the CLA Signed label Dec 23, 2025
Copy link
Copy Markdown
Contributor

@terrelln terrelln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @richardsonnick!

@terrelln terrelln merged commit bb1eedc into facebook:dev Feb 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants