> > mmap() returns MAP_FAILED, which is defined as (void *)-1, on error, > > not NULL. Several selftests incorrectly check the return value of > > mmap() using !ptr or ptr == NULL, which would erroneously treat > > MAP_FAILED as a valid pointer since MAP_FAILED is non-zero and > > non-NULL. This can lead to segfaults when mmap() actually fails > > under memory pressure. > > > > Signed-off-by: Hongfu Li <[email protected]> > > Reviewed-by: Dev Jain <[email protected]> > > You forgot my tag :) > > Also, please do not send a respin right away if you can, multiple revisions in > one day can be tricky to deal with. > > As per David's points - please update the commit message to reflect the fact > you've added a missing assert too and replace the (void *)-1 with MAP_FAILED.
Thanks for the reminder. I will avoid sending a quick respin within the same day, and I'll update the commit message to mention the added assert check, and replace (void *)-1 with MAP_FAILED in the next version.

